Commit graph

20 commits

Author SHA1 Message Date
varkor
24a2929ed1 Normalise notes with the/is 2020-01-24 16:24:50 +00:00
Tyler Mandry
9175247e72
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` — I'm not totally sure it worked right, though — 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.
2019-11-01 11:20:07 -07:00
jack-t
08ca2360c4 Add lint for unnecessary parens around types 2019-10-29 18:11:12 +00:00
Esteban Küber
0baf61bfdb Increase spacing for suggestions in diagnostics
Make the spacing between the code snippet and verbose structured
suggestions consistent with note and help messages.
2019-10-24 12:26:01 -07:00
Zack M. Davis
acc4e564fe in which we suggest anonymizing single-use lifetimes in paths 2019-07-06 15:04:18 -07:00
Zack M. Davis
e12d682dde path-type examples for single-use lifetime in fn argument UI test
Niko Matsakis commented in October 2017
(https://github.com/rust-lang/rust/issues/44752#issuecomment-340885834)
that these should lint. They do! Let's reify that in the tests now
(and then we'll see a nice diff when we add suggestions in a future
commit).
2019-07-06 15:04:18 -07:00
Yuki Okushi
c004451a20 Migrate compile-pass annotations to build-pass 2019-07-03 06:30:28 +09:00
Vadim Petrochenkov
8e8fba1b3b compiletest: Validate pass modes harder 2019-06-16 12:23:22 +03:00
Zack M. Davis
17653dd3da in which we decline to lint single-use lifetimes in derived impls
Resolves #53738.
2019-06-14 00:07:27 -07:00
Vadim Petrochenkov
fa72a81bea Update tests 2019-03-11 23:10:26 +03:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Zack M. Davis
faea5bbc65 single-use-lifetime lint: don't false-positive on the anonymous lifetime 2018-10-28 00:14:41 -07:00
Zack M. Davis
fd28753e83 structured suggestions for single-use lifetime lint on fns and methods
It would be nice to demonstrate the shining correctness here with more
run-rustfix tests than this, but unfortunately, that doesn't work with
multipart suggestions yet (#53934).

While we're here, reword the zero-use lifetime suggestion to "elide
the unused lifetime" instead of "remove it". (It's classier.)
2018-10-28 00:14:41 -07:00
Zack M. Davis
b1b684ef23 structured suggestions for unused-lifetimes lint 2018-10-07 19:17:39 -07:00
Matthias Krüger
71120ef1e5 Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
Oliver Schneider
53d2ebb0ad Implement existential types 2018-07-18 10:53:08 +02:00
Esteban Küber
973baaa5b2 Add label to lint for lifetimes used once 2018-06-21 18:21:49 -07:00
Vadim Petrochenkov
e60eaf59df Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
Niko Matsakis
0a9dcaf04f add warnings for unused lifetime parameters 2018-05-04 05:54:01 -04:00
Niko Matsakis
aef29a0583 fix single-use lint 2018-05-04 05:54:01 -04:00