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

in which unused-parens suggestions heed what the user actually wrote #55138

Merged
merged 1 commit into from Oct 25, 2018

Conversation

Projects
None yet
4 participants
@zackmdavis
Member

zackmdavis commented Oct 17, 2018

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 #55109.

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. (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 #55109.
@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Oct 17, 2018

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@pnkfelix

This comment has been minimized.

Member

pnkfelix commented Oct 23, 2018

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented Oct 23, 2018

📌 Commit 475be10 has been approved by pnkfelix

@pnkfelix

This comment has been minimized.

Member

pnkfelix commented Oct 23, 2018

@bors rollup

kennytm added a commit to kennytm/rust that referenced this pull request Oct 24, 2018

Rollup merge of rust-lang#55138 - zackmdavis:the_paren_trap, r=pnkfelix
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.

bors added a commit that referenced this pull request Oct 25, 2018

Auto merge of #55320 - kennytm:rollup, r=kennytm
Rollup of 22 pull requests

Successful merges:

 - #53507 (Add doc for impl From for Waker)
 - #54626 (rustc: Tweak filenames encoded into metadata)
 - #54965 (update tcp stream documentation)
 - #54977 (Accept `Option<Box<$t:ty>>` in macro argument)
 - #55138 (in which unused-parens suggestions heed what the user actually wrote)
 - #55167 (Add a "cheap" mode for `compute_missing_ctors`.)
 - #55173 (Suggest appropriate syntax on missing lifetime specifier in return type)
 - #55225 (Move cg_llvm:🔙:linker to cg_utils)
 - #55245 (submodules: update clippy from 5afdf8b7 to b1d03437)
 - #55247 (Clarified code example in char primitive doc)
 - #55251 (Fix a typo in the documentation of RangeInclusive)
 - #55253 (only issue "variant of the expected type" suggestion for enums)
 - #55254 (Correct trailing ellipsis in name_from_pat)
 - #55257 (Allow extern statics with an extern type)
 - #55258 (Fix Rustdoc ICE when checking blanket impls)
 - #55262 (Change the ICE from #55223 to a hard error)
 - #55269 (fix typos in various places)
 - #55271 (Unimplement ExactSizeIterator for MIR traversing iterators)
 - #55282 (Remove redundant clone)
 - #55285 (Do some copy editing on the release notes)
 - #55291 (Update stdsimd submodule)
 - #55303 (Update compiler-builtins submodule)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Oct 25, 2018

Auto merge of #55320 - kennytm:rollup, r=kennytm
Rollup of 28 pull requests

Successful merges:

 - #53507 (Add doc for impl From for Waker)
 - #53931 (Gradually expanding libstd's keyword documentation)
 - #54626 (rustc: Tweak filenames encoded into metadata)
 - #54921 (Add line numbers option to rustdoc)
 - #54965 (update tcp stream documentation)
 - #54977 (Accept `Option<Box<$t:ty>>` in macro argument)
 - #55138 (in which unused-parens suggestions heed what the user actually wrote)
 - #55167 (Add a "cheap" mode for `compute_missing_ctors`.)
 - #55173 (Suggest appropriate syntax on missing lifetime specifier in return type)
 - #55200 (Documents `From` implementations for `Stdio`)
 - #55225 (Move cg_llvm:🔙:linker to cg_utils)
 - #55245 (submodules: update clippy from 5afdf8b7 to b1d03437)
 - #55247 (Clarified code example in char primitive doc)
 - #55251 (Fix a typo in the documentation of RangeInclusive)
 - #55253 (only issue "variant of the expected type" suggestion for enums)
 - #55254 (Correct trailing ellipsis in name_from_pat)
 - #55257 (Allow extern statics with an extern type)
 - #55258 (Fix Rustdoc ICE when checking blanket impls)
 - #55262 (Change the ICE from #55223 to a hard error)
 - #55269 (fix typos in various places)
 - #55271 (Unimplement ExactSizeIterator for MIR traversing iterators)
 - #55282 (Remove redundant clone)
 - #55285 (Do some copy editing on the release notes)
 - #55291 (Update stdsimd submodule)
 - #55296 (Set RUST_BACKTRACE=0 for rustdoc-ui/failed-doctest-output.rs)
 - #55303 (Update compiler-builtins submodule)
 - #55306 (Regression test for #54478.)
 - #55328 (Fix doc for new copysign functions)

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Oct 25, 2018

Rollup merge of rust-lang#55138 - zackmdavis:the_paren_trap, r=pnkfelix
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.

bors added a commit that referenced this pull request Oct 25, 2018

Auto merge of #55347 - pietroalbini:rollup, r=pietroalbini
Rollup of 22 pull requests

Successful merges:

 - #53507 (Add doc for impl From for Waker)
 - #53931 (Gradually expanding libstd's keyword documentation)
 - #54965 (update tcp stream documentation)
 - #54977 (Accept `Option<Box<$t:ty>>` in macro argument)
 - #55138 (in which unused-parens suggestions heed what the user actually wrote)
 - #55173 (Suggest appropriate syntax on missing lifetime specifier in return type)
 - #55200 (Documents `From` implementations for `Stdio`)
 - #55245 (submodules: update clippy from 5afdf8b7 to b1d03437)
 - #55247 (Clarified code example in char primitive doc)
 - #55251 (Fix a typo in the documentation of RangeInclusive)
 - #55253 (only issue "variant of the expected type" suggestion for enums)
 - #55254 (Correct trailing ellipsis in name_from_pat)
 - #55269 (fix typos in various places)
 - #55282 (Remove redundant clone)
 - #55285 (Do some copy editing on the release notes)
 - #55291 (Update stdsimd submodule)
 - #55296 (Set RUST_BACKTRACE=0 for rustdoc-ui/failed-doctest-output.rs)
 - #55306 (Regression test for #54478.)
 - #55328 (Fix doc for new copysign functions)
 - #55340 (Operands no longer appear in places)
 - #55345 (Remove is_null)
 - #55348 (Update RELEASES.md after destabilization of non_modrs_mods)

Failed merges:

r? @ghost

@bors bors merged commit 475be10 into rust-lang:master Oct 25, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment