Commit graph

8518 commits

Author SHA1 Message Date
Amanieu d'Antras
d25b25610b Handle InlineAsm in clippy 2020-05-18 14:41:33 +01:00
flip1995
f1d3086492 Merge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup 2020-05-17 17:36:26 +02:00
Ralf Jung
8bba1b7589 Rollup merge of #72047 - Julian-Wollersberger:literal_error_reporting_cleanup, r=petrochenkov
Literal error reporting cleanup

While doing some performance work, I noticed some code duplication in `librustc_parser/lexer/mod.rs`, so I cleaned it up.

This PR is probably best reviewed commit by commit.

I'm not sure what the API stability practices for `librustc_lexer` are. Four public methods in `unescape.rs` can be removed, but two are used by clippy, so I left them in for now.
I could open a PR for Rust-Analyzer when this one lands.

But how do I open a PR for clippy? (Git submodules are frustrating to work with)
2020-05-16 19:46:31 +02:00
Dylan DPC
b381ea8abb Rollup merge of #72090 - RalfJung:rustc_driver-exit-code, r=oli-obk
rustc_driver: factor out computing the exit code

In a recent Miri PR I [added a convenience wrapper](https://github.com/rust-lang/miri/pull/1405/files#diff-c3d602c5c8035a16699ce9c015bfeceaR125) around `catch_fatal_errors` and `run_compiler` that @oli-obk suggested I could upstream. However, after seeing what could be shared between `rustc_driver::main`, clippy and Miri, really the only thing I found is computing the exit code -- so that's what this PR does.

What prevents using the Miri convenience function in `rustc_driver::main` and clippy is that they do extra work inside `catch_fatal_errors`, and while I could abstract that away, clippy actually *computes the callbacks* inside there, and I fond no good way to abstract that and thus gave up. Maybe the clippy thing could be moved out, I am not sure if it ever can actually raise a `FatalErrorMarker` -- someone more knowledgeable in clippy would have to do that.
2020-05-16 02:37:23 +02:00
Dylan DPC
b0490cc80d Rollup merge of #71948 - csmoe:issue-61076, r=oli-obk
Suggest to await future before ? operator

Closes https://github.com/rust-lang/rust/issues/71811
cc #61076
2020-05-16 02:37:21 +02:00
csmoe
0a86335cd4 implement type_implments_trait query 2020-05-15 15:37:11 +08:00
Julian Wollersberger
ff9a9ed37c Replace some usages of the old unescape_ functions in AST, clippy and tests. 2020-05-13 10:05:04 +02:00
flip1995
d13d8987b0 Merge commit '43a1777b89cf6791f9e20878b4e5e3ae907867a5' into clippyup 2020-05-11 20:23:47 +02:00
Ralf Jung
30822733f0 rustc_driver: factor out computing the exit code 2020-05-10 23:36:41 +02:00
Ralf Jung
51158cc71f Rollup merge of #71555 - cjgillot:nameless, r=matthewjasper
Remove ast::{Ident, Name} reexports.

The reexport of `Symbol` into `Name` confused me.
2020-05-09 13:36:39 +02:00
Camille GILLOT
31c84e5077 Fix clippy. 2020-05-08 13:57:01 +02:00
Jack Huey
0e2f5c9862 Fix nit and cargo.lock 2020-05-07 17:46:31 -04:00
Dylan MacKenzie
41fe5c1ca7 Update clippy lint 2020-05-03 11:41:03 -07:00
Vadim Petrochenkov
2d10babb71 Stabilize fn-like proc macros in expression, pattern and statement positions 2020-05-03 19:24:41 +03:00
bors
d2708873ef Auto merge of #5548 - matthiaskrgr:traget_os, r=flip1995
mismatched_target_os: link to respective section in rust reference

changelog: none
2020-05-01 16:33:14 +00:00
Matthias Krüger
b7800e1ac3 mismatched_target_os: link to respective section in rust reference 2020-05-01 01:21:24 +02:00
bors
0a53ed2d8e Auto merge of #5547 - CrazyRoka:fix-clone-double-ref-suggestion, r=flip1995
Fixed incorrect suggestion of `clone_double_ref` lint

- Added `<_>` to suggestion
- Changed help message
- Added new tests
Closes #5494

changelog: Improve suggestion of [`clone_double_ref`]
2020-04-29 20:05:18 +00:00
CrazyRoka
20c069beec Fixed incorrect suggestion of clone_double_ref lint
- Added `<_>` to suggestion
- Changed help message
2020-04-29 22:40:57 +03:00
bors
28197b6226 Auto merge of #5545 - flip1995:rustup, r=flip1995
Rustup to rust-lang/rust#71518

changelog: none
2020-04-29 13:59:30 +00:00
flip1995
cd3480991a
Rustup to rust-lang/rust#71518 2020-04-29 15:48:43 +02:00
bors
9a3b0a0588 Auto merge of #5543 - matthiaskrgr:rustup_45, r=flip1995
rustup https://github.com/rust-lang/rust/pull/71292/

cc https://github.com/rust-lang/rust/issues/71608

---

changelog: none
2020-04-28 18:30:01 +00:00
Matthias Krüger
bdc9528e7c rustup https://github.com/rust-lang/rust/pull/71292/ 2020-04-28 15:05:56 +02:00
bors
2c4d566113 Auto merge of #5535 - ebroto:issue_5360, r=phansch
used_underscore_binding: do not lint on `await` desugaring

changelog: used_underscore_binding: do not lint on `await` desugaring

Fixes #5360
2020-04-28 05:36:30 +00:00
Eduardo Broto
fc5fc6378c Test that we lint the awaited expression 2020-04-27 21:29:31 +02:00
Eduardo Broto
3a96f548d1 used_underscore_binding: do not lint on await desugaring 2020-04-27 21:20:08 +02:00
bors
f2486b3d35 Auto merge of #5538 - csmoe:rustup, r=phansch
rustup: rust-lang/rust#71628

cc https://github.com/rust-lang/rust/issues/71608

changelog: none
2020-04-27 16:58:24 +00:00
csmoe
305177d9cc rustup: rust-lang/rust#71628 2020-04-27 22:40:56 +08:00
bors
d13ffbe3fe Auto merge of #5522 - CrazyRoka:match_vec_item, r=phansch
New  lint `match_vec_item`

Added new lint to warn a match on index item which can panic. It's always better to use `get(..)` instead.
Closes #5500
changelog: New lint `match_on_vec_items`
2020-04-27 06:02:05 +00:00
bors
5d8a3e8724 Auto merge of #5506 - ebroto:mismatched_target_os, r=flip1995
Implement mismatched_target_os lint

I've extended the check suggested in the issue to all the currently supported operating systems instead of limiting it to `linux` and `macos`, let me know if we want to do this.

Also, I've restored the text `There are over XXX lints ...` in the README as it was matched against by `cargo dev new_lint`.

changelog: Added `mismatched_target_os` lint to warn when an operating system is used in target family position in a #[cfg] attribute

Closes #3949
2020-04-27 02:29:49 +00:00
Eduardo Broto
303e7d1af8 Split tests in unix/non-unix 2020-04-26 21:27:29 +02:00
Eduardo Broto
4a405c9977 Remove some OSes from the test to comply with stderr line limit 2020-04-26 21:27:29 +02:00
Eduardo Broto
ce50e42ed6 Use the span of the attribute for the error message 2020-04-26 21:27:29 +02:00
Eduardo Broto
d24a106395 Apply suggestions from PR review
- Show just one error message with multiple suggestions in case of
  using multiple times an OS in target family position
- Only suggest #[cfg(unix)] when the OS is in the Unix family
- Test all the operating systems
2020-04-26 21:27:29 +02:00
Eduardo Broto
149f6d6046 Implement mismatched_target_os lint 2020-04-26 21:27:29 +02:00
CrazyRoka
b574941dcb Updated lint info in lib.rs 2020-04-26 18:11:21 +03:00
CrazyRoka
940c662654 Small lint update
- Changed lint category to `correctness`
- Moved main function to bottom in test file
- Added `FIXME` comment to `span_lint_and_sugg` to improve later
2020-04-26 18:00:51 +03:00
bors
87a6f3fc2c Auto merge of #5534 - phansch:remove-util-dev, r=flip1995
Remove util/dev script

`cargo dev` has been the replacement for a while, so I think we can
remove it now.

cc #5394

changelog: none
2020-04-26 14:44:08 +00:00
bors
5c12f2b286 Auto merge of #5509 - phansch:more-diagnostic-items2, r=matthiaskrgr
Use more diagnostic items

In particular for:

* `VecDeque`
* `String`
* `Mutex`
* `HashMap`
* `HashSet`

cc rust-lang/rust#71414 #5393

---

changelog: none
2020-04-26 12:30:52 +00:00
Philipp Hansch
eda73fe707
Fix cargo crash 2020-04-26 14:11:58 +02:00
Philipp Hansch
8d596ea01c
Remove util/dev script
`cargo dev` has been the replacement for a while, so I think we can
remove it now.

cc #5394
2020-04-26 14:00:03 +02:00
Philipp Hansch
0a49935270
cargo dev fmt 2020-04-26 13:44:08 +02:00
Philipp Hansch
0480ff861a
More diagnostic items
In particular for:

* `VecDeque`
* `String`
* `Mutex`
* `HashMap`
* `HashSet`

cc https://github.com/rust-lang/rust/pull/71414 https://github.com/rust-lang/rust-clippy/issues/5393
2020-04-26 13:44:08 +02:00
bors
b7c802b5e3 Auto merge of #5533 - phansch:rustup001, r=matthiaskrgr
rustup to https://github.com/rust-lang/rust/pull/70043

changelog: none
2020-04-26 11:26:15 +00:00
Philipp Hansch
5b1622b324
rustup to https://github.com/rust-lang/rust/pull/70043 2020-04-26 10:12:14 +02:00
bors
07dd5fada9 Auto merge of #5511 - alex-700:fix-redundant-pattern-matching, r=flip1995
Fix redundant_pattern_matching lint

fixes #5504

changelog: Fix suggestion in `redundant_pattern_matching` for macros.
2020-04-25 21:41:56 +00:00
bors
44eb953adc Auto merge of #5525 - flip1995:issue_1654, r=phansch
Don't trigger while_let_on_iterator when the iterator is recreated every iteration

r? @phansch

Fixes #1654

changelog: Fix false positive in [`while_let_on_iterator`]
2020-04-25 21:29:03 +00:00
bors
a76bfd46c5 Auto merge of #5530 - ebroto:issue_5524, r=flip1995
map_clone: avoid suggesting `copied()` for &mut

changelog: map_clone: avoid suggesting `copied()` for &mut

Fixes #5524
2020-04-25 21:16:06 +00:00
Eduardo Broto
806d973adc map_clone: avoid suggesting copied() for &mut 2020-04-25 22:52:19 +02:00
Aleksei Latyshev
69fe6b4c98
fix redundant_pattern_matching lint
- now it gives correct suggestion in case of macros
- better tests
- remove a couple of non-relevant tests
2020-04-25 23:51:30 +03:00
bors
77c23b7089 Auto merge of #5527 - flip1995:rollup-pr2htfd, r=flip1995
Rollup of 5 pull requests

Successful merges:

 - #5408 (Downgrade match_bool to pedantic)
 - #5505 (Avoid running cargo+internal lints when not enabled)
 - #5516 (Add a note to the beta sections of release.md)
 - #5517 (Deploy time travel)
 - #5523 (Add lifetime test case for `new_ret_no_self`)

Failed merges:

r? @ghost

changelog: rollup
2020-04-25 19:38:04 +00:00