-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Replace more uses of snippet_opt
.
#13296
Conversation
r? @Alexendoo rustbot has assigned @Alexendoo. Use |
8b833ea
to
4ff5673
Compare
4ff5673
to
9450b4a
Compare
self.sf | ||
.src | ||
.as_ref() | ||
.or_else(|| self.sf.external_src.get().and_then(|src| src.get_source())) |
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.
Are there cases where we actually want to return a snippet pointing to an external crate? My gut reaction is that would almost always indicate a macro handling bug
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.
unnecessary_cast
uses it to deal with type aliases.
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.
Ah I see, that's quite the hack. What do you think about using SourceMap
for that one manually and skipping external sources for the clippy_utils
method? It would make issues of the #12837 variety easier to notice
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.
I only noticed unnecessary_cast
because it has a test for that case. Given that this might silently break lints and I don't really want to audit all uses of it right now it's better to leave it as is.
Thanks! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Almost all calls are removed after this.
changelog: none