Commit graph

146 commits

Author SHA1 Message Date
Samuel Moelius
9cc8da222b Fix adjacent code 2022-10-07 05:07:44 -04:00
Yuri Astrakhan
cb6d1267c4 a few more core lint fixes 2022-09-23 13:55:30 -04:00
Marco Mastropaolo
de028e2fb9 Implemented suspicious_to_owned lint to check if to_owned is called on a Cow.
This is done because `to_owned` is very similarly named to `into_owned`, but the
effect of calling those two methods is completely different. This creates
confusion (stemming from the ambiguity of the 'owned' term in the context of
`Cow`s) and might not be what the writer intended.
2022-08-26 17:41:17 -07:00
Philipp Krones
070b0350df
Improve error if rustfix coverage test spuriously fails 2022-08-21 11:57:05 +02:00
Jason Newcomb
48cb816530 Handle CARGO_TARGET_DIR not being set in compile-test 2022-08-16 21:22:29 -04:00
Serial
343476df0f Use CARGO_TARGET_DIR in compile-test 2022-08-16 17:17:21 -04:00
Allen Hsu
b96842d7d7 Split unfixable lints. 2022-08-02 22:00:04 +10:00
Samuel E. Moelius III
5b3300dc29 Add ui_cargo_toml_metadata test 2022-07-17 22:17:58 -04:00
Philipp Krones
f074034590
Merge remote-tracking branch 'upstream/master' into rustup 2022-07-15 09:49:15 +02:00
Allen Hsu
8878d674b1 Lint for repeated traits within trait bounds or where clauses. 2022-07-12 22:03:55 +10:00
Philipp Krones
09f5df5087 Merge commit '0cb0f7636851f9fcc57085cf80197a2ef6db098f' into clippyup 2022-06-30 10:50:09 +02:00
Philipp Krones
f26cf11fe8
Merge remote-tracking branch 'upstream/master' into rustup 2022-06-30 10:27:25 +02:00
Marcel Hellwig
6384765665 parse Cargo.toml file in ui-cargo tests
compiletest_rs is not meant to test full cargo projects, but instead
only files.
So we need to parse the `Cargo.toml` file ourself and set the
corresponding environment variable. In this case we just set
`CARGO_PKG_RUST_VERSION`, nothing more. But, of course, this can be
extended.
2022-06-28 08:03:48 +02:00
Serial
aec465cabd Add test for [default_deprecation_reason] 2022-06-24 14:11:24 -04:00
Maybe Waffle
f095f802dc Move/rename lazy::Sync{OnceCell,Lazy} to sync::{Once,Lazy}Lock 2022-06-16 19:54:42 +04:00
Philipp Krones
7713f28f54 Remove unnecessary clap_derive dependency added in 9ee211af
The fixed issue in this commit can be tested without depending on
clap/clap_derive. This updates the test case to do so.
2022-06-04 14:04:35 +02:00
Philipp Krones
f067783461 Merge commit 'd9ddce8a223cb9916389c039777b6966ea448dc8' into clippyup 2022-06-04 13:34:07 +02:00
lengyijun
202fdb9c53 split into borrow_deref_ref.rs and borrow_deref_ref_unfixable.rs 2022-06-01 15:43:48 +00:00
bors
5920fa3516 Auto merge of #8844 - smoelius:fixed-paths, r=Alexendoo
Check `.fixed` paths' existence in `run_ui`

This PR adds a test to check that there exists a `.fixed` file for every `.stderr` file in `tests/ui` that mentions a `MachineApplicable` lint. The test leverages `compiletest-rs`'s `rustfix_coverage` option.

I tried to add `.fixed` files where they appeared to be missing. However, 38 exceptional `.rs` files remain. Several of those include comments indicating that they are exceptions, though not all do. Apologies, as I have not tried to associate the 38 files with GH issues. (I think that would be a lot of work, and I worry about linking the wrong issue.)

changelog: none
2022-05-28 11:28:04 +00:00
Samuel E. Moelius III
6027255eb2 Ignore crashes dir 2022-05-27 16:44:02 -04:00
Samuel E. Moelius III
8f49e4127f Fix assert! message 2022-05-27 15:18:46 -04:00
Samuel E. Moelius III
c91a7f0b83 Address review comments 2022-05-27 15:18:46 -04:00
Samuel E. Moelius III
911eb1f4cd Check .fixed paths' existence in run_ui 2022-05-27 15:18:46 -04:00
Samuel E. Moelius III
9ee211af9f Fix empty_line_after_outer_attribute false positive 2022-05-25 19:35:26 -04:00
flip1995
d1b087fdee Merge commit 'dc5423ad448877e33cca28db2f1445c9c4473c75' into clippyup 2022-03-14 12:02:53 +01:00
Matthias Krüger
7a15061fbc tests: use std:🧵:available_parallelism() instead of num_cpus to get thread count
removes the dependency added in https://github.com/rust-lang/rust-clippy/pull/8451
2022-03-01 21:32:18 +01:00
flip1995
bca4ee7971
Implement internal lint for MSRV lints
This internal lint checks if the `extract_msrv_attrs!` macro is used if
a lint has a MSRV. If not, it suggests to add this attribute to the lint
pass implementation.
2022-03-01 09:40:07 +00:00
flip1995
35020280a0 Merge commit 'e329249b6a3a98830d860c74c8234a8dd9407436' into clippyup 2022-02-26 14:26:21 +01:00
Matthias Krüger
a89c7958f5 tests: default to more threads for ui-tests
Benchmarks (tested on i5-7200U, 2 core 4 threads)

```
master branch:

cargo test // prime caches
cargo --color=always test  70,39s user 21,91s system 180% cpu 51,035 total
cargo --color=always test  70,77s user 22,13s system 180% cpu 51,579 total
cargo --color=always test  70,97s user 22,12s system 180% cpu 51,673 total

cargo --color=always nextest run  78,74s user 22,27s system 220% cpu 45,829 total
cargo --color=always nextest run  78,46s user 21,92s system 224% cpu 44,674 total
cargo --color=always nextest run  78,31s user 22,21s system 228% cpu 43,909 total

Patched (ui_speedup branch)

cargo test // prime cache
cargo --color=always test  97,51s user 32,02s system 288% cpu 44,905 total
cargo --color=always test  99,19s user 31,91s system 276% cpu 47,436 total
cargo --color=always test  98,47s user 31,84s system 284% cpu 45,744 total

cargo --color=always nextest run  102,18s user 30,80s system 350% cpu 37,902 total
cargo --color=always nextest run  99,75s user 29,86s system 350% cpu 36,935 total
cargo --color=always nextest run  100,36s user 29,93s system 351% cpu 37,061 total
```
2022-02-20 14:07:41 +01:00
flip1995
611d039814 Merge commit '57b3c4b90f4346b3990c1be387c3b3ca7b78412c' into clippyup 2022-02-10 18:40:06 +01:00
Cameron Steffen
88fd090531 Factor out ui_test suite 2022-02-08 15:11:48 -06:00
Alex Macleod
04dce4aed4 Support cargo dev bless for tests with revisions 2022-02-06 13:00:17 +00:00
flip1995
bf66aeda0a Merge commit 'a98e7ab8b94485be6bd03e0c6b8682ecab5b52e6' into clippyup 2022-01-27 15:12:45 +01:00
Cameron Steffen
3afbae33ab Remove __CLIPPY_INTERNAL_TESTS env var 2022-01-17 12:37:05 -06:00
flip1995
fb0142ae41 Merge commit '97a5daa65908e59744e2bc625b14849352231c75' into clippyup 2022-01-13 13:18:19 +01:00
Cameron Steffen
51dbbf3c4c Refactor test utils 2022-01-10 15:22:17 -06:00
Cameron Steffen
e2ce4f9462 Combine internal features in clippy_lints 2022-01-09 18:35:12 -06:00
Nick Mathewson
65d1f83d2c Extend [unused_io_amount] to cover AsyncRead and AsyncWrite.
Clippy helpfully warns about code like this, telling you that you
probably meant "write_all":

    fn say_hi<W:Write>(w: &mut W) {
       w.write(b"hello").unwrap();
    }

This patch attempts to extend the lint so it also covers this
case:

    async fn say_hi<W:AsyncWrite>(w: &mut W) {
       w.write(b"hello").await.unwrap();
    }

(I've run into this second case several times in my own programming,
and so have my coworkers, so unless we're especially accident-prone
in this area, it's probably worth addressing?)

This patch covers the Async{Read,Write}Ext traits in futures-rs,
and in tokio, since both are quite widely used.

changelog: [`unused_io_amount`] now supports AsyncReadExt and AsyncWriteExt.
2021-12-31 12:10:59 -05:00
flip1995
8fea1d94f3 Merge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyup 2021-12-06 12:33:31 +01:00
bors
f82bf470d0 Auto merge of #7957 - surechen:fix_for_7854, r=giraffate
Support suggestion for #7854

I think the detection of parking_lot's mutex and rwlock is valuable, so submit this pr, please help judge and review, thank you.

Make let_underscore_lock support parking_lot.(Fixes #7854)

changelog: Make let_underscore_lock support parking_lot
2021-11-15 00:50:28 +00:00
surechen
634e79c655 Support suggestion for #7854
I think the detection of parking_lot's mutex and rwlock is valuable, so submit this pr, please help judge and review, thank you.

Make let_underscore_lock support parking_lot.

changelog: Make let_underscore_lock support parking_lot
2021-11-15 08:36:36 +08:00
flip1995
e674d0a599 Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyup 2021-11-04 12:52:36 +00:00
Andre Bogus
a4ede72b3d update most tests to 2021 edition 2021-10-30 14:50:53 +02:00
flip1995
7631fc5d82 Merge commit '91496c2ac6abf6454c413bb23e8becf6b6dc20ea' into clippyup 2021-10-21 13:11:36 +02:00
Andre Bogus
e88c956e1e avoid eq_op in test code 2021-10-19 21:02:30 +02:00
flip1995
5cf4984872 Merge commit 'b7f3f7f6082679da2da9a0b3faf1b5adef3afd3b' into clippyup 2021-10-07 11:21:30 +02:00
flip1995
23d5457e6d Merge commit 'cb7915b00c235e9b5861564f3be78dba330980ee' into clippyup 2021-09-28 18:03:12 +01:00
Cameron Steffen
f6c5d580b8 Improve depinfo error 2021-09-24 10:27:11 -05:00
Labelray
543b638dbe Add new lint if_then_panic 2021-09-24 22:14:20 +08:00
Cameron Steffen
1074bad06d Rename test_build_base to test 2021-09-08 14:07:03 -05:00