-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Unnecessary macro expansion in unused_parens lint #55109
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
Comments
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.
# for free
to join this conversation on GitHub.
Already have an account?
# 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: