-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When suggesting to import an item, also suggest changing the path if appropriate #96353
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
I think the ... notation is not easy to parse, given all the other punctuation that's present. What about "Consider importing this item / You can then refer to it directly"? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I have a strong opinion on the "... then" notation as opposed to more explicit phrasing, since we have examples of other suggestions split up by ...
.
Feel free to refine it if you want, or r=me if not.
@compiler-errors your comment has made me look for existing examples in the compiler. There were a bunch.
They read more clearly to me than
Maybe it's because of the suggested diff that's being printed, without the ^^^^ underlining? |
yeah, I think the verbose suggestion renders a bit strange, since unlike an addition it doesn't just have |
(Note that I don't feel strongly about it, this PR is an improvement even in the current state) |
I'm ok with changing the wording |
This comment was marked as resolved.
This comment was marked as resolved.
…appropriate When we don't find an item we search all of them for an appropriate import and suggest `use`ing it. This is sometimes done for expressions that have paths with more than one segment. We now also suggest changing that path to work with the `use`. Fix rust-lang#95413
Merging as per
@bors r=compiler-errors |
📌 Commit 4934a9e has been approved by |
⌛ Testing commit 4934a9e with merge 8c727a798c153d9239d2378e139f9a5028efdc24... |
💔 Test failed - checks-actions |
@bors retry transient error on apple runner it seems |
…rors When suggesting to import an item, also suggest changing the path if appropriate When we don't find an item we search all of them for an appropriate import and suggest `use`ing it. This is sometimes done for expressions that have paths with more than one segment. We now also suggest changing that path to work with the `use`. Fix rust-lang#95413
☀️ Test successful - checks-actions |
Finished benchmarking commit (9add632): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
When we don't find an item we search all of them for an appropriate
import and suggest
use
ing it. This is sometimes done for expressionsthat have paths with more than one segment. We now also suggest changing
that path to work with the
use
.Fix #95413