-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Unnecessary macro expansion in unused_parens lint #55109
Labels
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
Comments
Aaron1011
changed the title
Unnecessary macro expansion in unused_parens lit
Unnecessary macro expansion in unused_parens lint
Oct 16, 2018
Havvy
added
the
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
label
Oct 16, 2018
Ah, I think this is because we should be using |
zackmdavis
added a commit
to zackmdavis/rust
that referenced
this issue
Oct 17, 2018
Aaron Hill pointed out that unnecessary parens around a macro call (paradigmatically, `format!`) yielded a suggestion of hideous macro-expanded code. (The slightly unusual choice of using the pretty-printer to compose suggestions was quite recently commented on in the commit message for 1081bbb ("abolish ICE when pretty-printing async block"), but without any grounds to condemn it as a 𝘣𝘢𝘥 choice. Hill's report provides the grounds.) `span_to_snippet` is fallable as far as the type system is concerned (because, who knows, macros or something), so the pretty-printing can live on in the oft-neglected `else` branch. Resolves rust-lang#55109.
kennytm
added a commit
to kennytm/rust
that referenced
this issue
Oct 24, 2018
in which unused-parens suggestions heed what the user actually wrote Aaron Hill pointed out that unnecessary parens around a macro call (paradigmatically, `format!`) yielded a suggestion of hideous macro-expanded code. `span_to_snippet` is fallable as far as the type system is concerned, so the pretty-printing can live on in the oft-neglected `else` branch. Resolves rust-lang#55109.
pietroalbini
added a commit
to pietroalbini/rust
that referenced
this issue
Oct 25, 2018
in which unused-parens suggestions heed what the user actually wrote Aaron Hill pointed out that unnecessary parens around a macro call (paradigmatically, `format!`) yielded a suggestion of hideous macro-expanded code. `span_to_snippet` is fallable as far as the type system is concerned, so the pretty-printing can live on in the oft-neglected `else` branch. Resolves rust-lang#55109.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code snippet (playground)
results in the following lint output:
The
help: remove these parentheses
should contain the literal stringformat!
, not the expanded macro that it repreesnts.The text was updated successfully, but these errors were encountered: