]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #65112 - jack-t:type-parens-lint, r=varkor
authorTyler Mandry <tmandry@gmail.com>
Fri, 1 Nov 2019 18:20:07 +0000 (11:20 -0700)
committerGitHub <noreply@github.com>
Fri, 1 Nov 2019 18:20:07 +0000 (11:20 -0700)
commit9175247e72a3d7cba4bdb61bc490da9be0460d51
treee76941bac9c5c453d5897d45025915fedacf8b5c
parent01e5d91482e3e8fb9f55efabab760db2d50ddaff
parent08ca2360c4e817acab717dfb7e5a93d5af35cc06
Rollup merge of #65112 - jack-t:type-parens-lint, r=varkor

Add lint and tests for unnecessary parens around types

This is my first contribution to the Rust project, so I apologize if I'm not doing things the right way.

The PR fixes #64169. It adds a lint and tests for unnecessary parentheses around types. I've run `tidy` and `rustfmt` &mdash; I'm not totally sure it worked right, though &mdash; and I've tried to follow the instructions linked in the readme.

I tried to think through all the variants of `ast::TyKind` to find exceptions to this lint, and I could only find the one mentioned in the original issue, which concerns types with `dyn`. I'm not a Rust expert, thought, so I may well be missing something.

There's also a problem with getting this to build. The new lint catches several things in the, e.g., `core`. Because `x.py` seems to build with an equivalent of `-Werror`, what would have been warnings cause the build to break. I got it to build and the tests to pass with `--warnings warn` on my `x.py build` and `x.py test` commands.
src/librustc_lint/unused.rs
src/libstd/collections/hash/map.rs