-
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
Use macro callsite when creating Sugg
helper
#9410
Conversation
r? @xFrednet (rust-highfive has picked a reviewer for you, use r? to override) |
@rustbot author (Since this is still a draft PR :)) |
let get_whole_snippet = || { | ||
if expr.span.from_expansion() { | ||
snippet_with_macro_callsite(cx, expr.span, default) | ||
let snippet_without_expansion = |cx, span: Span, default| { |
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'm not sure if we want this in clippy utils
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.
For now, I would keep it local to this function. Macros are not the simplest thing to deal with, and I prefer contributors to ignore them rather than trying to add suggestions for them. But that is mostly my personal preference, you can extract it if you want 🙃
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.
That's fair. I'll leave it as it is then
Sugg
helperSugg
helper
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.
Looks good to me, thank you for the bug fix.
I left an answer to your question. You can resolve it or extract the function, either is fine. And then you can r=me
🙃
let get_whole_snippet = || { | ||
if expr.span.from_expansion() { | ||
snippet_with_macro_callsite(cx, expr.span, default) | ||
let snippet_without_expansion = |cx, span: Span, default| { |
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.
For now, I would keep it local to this function. Macros are not the simplest thing to deal with, and I prefer contributors to ignore them rather than trying to add suggestions for them. But that is mostly my personal preference, you can extract it if you want 🙃
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Closes #9375
changelog: Improvement: [
collapsible_if
]: Suggestions now work with macros, by taking the call site into account.