Skip to content

Commit ba252ed

Browse files
committed
Make the default suggestions show the full patch output
Before ``` error: almost complete ascii range --> tests/ui/almost_complete_range.rs:17:17 | LL | let _ = ('a') ..'z'; | ^^^^^^--^^^ | | | help: use an inclusive range: `..=` | = note: `-D clippy::almost-complete-range` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::almost_complete_range)]` ``` After ``` error: almost complete ascii range --> tests/ui/almost_complete_range.rs:17:17 | LL | let _ = ('a') ..'z'; | ^^^^^^^^^^^ | = note: `-D clippy::almost-complete-range` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::almost_complete_range)]` help: use an inclusive range | LL | let _ = ('a') ..='z'; | ~~~ ```
1 parent 1cfd47f commit ba252ed

File tree

863 files changed

+30276
-7079
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

863 files changed

+30276
-7079
lines changed

compiler/rustc_errors/src/diagnostic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
979979
msg,
980980
suggestion,
981981
applicability,
982-
SuggestionStyle::ShowCode,
982+
SuggestionStyle::ShowAlways,
983983
);
984984
self
985985
} }

src/tools/clippy/tests/ui-toml/array_size_threshold/array_size_threshold.stderr

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ error: large array defined as const
22
--> tests/ui-toml/array_size_threshold/array_size_threshold.rs:4:1
33
|
44
LL | const ABOVE: [u8; 11] = [0; 11];
5-
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^
6-
| |
7-
| help: make this a static item: `static`
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86
|
97
= note: `-D clippy::large-const-arrays` implied by `-D warnings`
108
= help: to override `-D warnings` add `#[allow(clippy::large_const_arrays)]`
9+
help: make this a static item
10+
|
11+
LL | static ABOVE: [u8; 11] = [0; 11];
12+
| ~~~~~~
1113

1214
error: allocating a local array larger than 10 bytes
1315
--> tests/ui-toml/array_size_threshold/array_size_threshold.rs:4:25

src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.stderr

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ error: integer literal has a better hexadecimal representation
22
--> tests/ui-toml/decimal_literal_representation/decimal_literal_representation.rs:4:13
33
|
44
LL | let _ = 16777215;
5-
| ^^^^^^^^ help: consider: `0x00FF_FFFF`
5+
| ^^^^^^^^
66
|
77
= note: `-D clippy::decimal-literal-representation` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::decimal_literal_representation)]`
9+
help: consider
10+
|
11+
LL | let _ = 0x00FF_FFFF;
12+
| ~~~~~~~~~~~
913

1014
error: aborting due to 1 previous error
1115

src/tools/clippy/tests/ui-toml/explicit_iter_loop/explicit_iter_loop.stderr

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,25 @@ error: it is more concise to loop over references to containers instead of using
22
--> tests/ui-toml/explicit_iter_loop/explicit_iter_loop.rs:6:14
33
|
44
LL | for _ in rmvec.iter() {}
5-
| ^^^^^^^^^^^^ help: to write this more concisely, try: `&*rmvec`
5+
| ^^^^^^^^^^^^
66
|
77
= note: `-D clippy::explicit-iter-loop` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::explicit_iter_loop)]`
9+
help: to write this more concisely, try
10+
|
11+
LL | for _ in &*rmvec {}
12+
| ~~~~~~~
913

1014
error: it is more concise to loop over references to containers instead of using explicit iteration methods
1115
--> tests/ui-toml/explicit_iter_loop/explicit_iter_loop.rs:8:14
1216
|
1317
LL | for _ in rmvec.iter_mut() {}
14-
| ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut *rmvec`
18+
| ^^^^^^^^^^^^^^^^
19+
|
20+
help: to write this more concisely, try
21+
|
22+
LL | for _ in &mut *rmvec {}
23+
| ~~~~~~~~~~~
1524

1625
error: aborting due to 2 previous errors
1726

src/tools/clippy/tests/ui-toml/large_futures/large_futures.stderr

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ error: large future with a size of 1026 bytes
22
--> tests/ui-toml/large_futures/large_futures.rs:18:5
33
|
44
LL | should_warn().await;
5-
| ^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(should_warn())`
5+
| ^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::large-futures` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::large_futures)]`
9+
help: consider `Box::pin` on it
10+
|
11+
LL | Box::pin(should_warn()).await;
12+
| ~~~~~~~~~~~~~~~~~~~~~~~
913

1014
error: aborting due to 1 previous error
1115

src/tools/clippy/tests/ui-toml/large_types_passed_by_value/large_types_passed_by_value.stderr

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ error: this argument (513 byte) is passed by value, but might be more efficient
22
--> tests/ui-toml/large_types_passed_by_value/large_types_passed_by_value.rs:4:11
33
|
44
LL | fn f2(_v: [u8; 513]) {}
5-
| ^^^^^^^^^ help: consider passing by reference instead: `&[u8; 513]`
5+
| ^^^^^^^^^
66
|
77
= note: `-D clippy::large-types-passed-by-value` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::large_types_passed_by_value)]`
9+
help: consider passing by reference instead
10+
|
11+
LL | fn f2(_v: &[u8; 513]) {}
12+
| ~~~~~~~~~~
913

1014
error: aborting due to 1 previous error
1115

src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.stderr

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,27 @@ error: digits grouped inconsistently by underscores
22
--> tests/ui-toml/lint_decimal_readability/test.rs:19:18
33
|
44
LL | let _fail1 = 100_200_300.123456789;
5-
| ^^^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.123_456_789`
5+
| ^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::inconsistent_digit_grouping)]`
9+
help: consider
10+
|
11+
LL | let _fail1 = 100_200_300.123_456_789;
12+
| ~~~~~~~~~~~~~~~~~~~~~~~
913

1014
error: long literal lacking separators
1115
--> tests/ui-toml/lint_decimal_readability/test.rs:22:18
1216
|
1317
LL | let _fail2 = 100200300.300200100;
14-
| ^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.300_200_100`
18+
| ^^^^^^^^^^^^^^^^^^^
1519
|
1620
= note: `-D clippy::unreadable-literal` implied by `-D warnings`
1721
= help: to override `-D warnings` add `#[allow(clippy::unreadable_literal)]`
22+
help: consider
23+
|
24+
LL | let _fail2 = 100_200_300.300_200_100;
25+
| ~~~~~~~~~~~~~~~~~~~~~~~
1826

1927
error: aborting due to 2 previous errors
2028

src/tools/clippy/tests/ui-toml/manual_let_else/manual_let_else.stderr

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ LL | |
66
LL | | Foo::A(x) => x,
77
LL | | Foo::B => return,
88
LL | | };
9-
| |______^ help: consider writing: `let Foo::A(x) = Foo::A(1) else { return };`
9+
| |______^
1010
|
1111
= note: `-D clippy::manual-let-else` implied by `-D warnings`
1212
= help: to override `-D warnings` add `#[allow(clippy::manual_let_else)]`
13+
help: consider writing
14+
|
15+
LL | let Foo::A(x) = Foo::A(1) else { return };
16+
|
1317

1418
error: aborting due to 1 previous error
1519

src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.stderr

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ error: you are using an explicit closure for cloning elements
22
--> tests/ui-toml/min_rust_version/min_rust_version.rs:74:26
33
|
44
LL | let _: Option<u64> = Some(&16).map(|b| *b);
5-
| ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `Some(&16).cloned()`
5+
| ^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::map-clone` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::map_clone)]`
9+
help: consider calling the dedicated `cloned` method
10+
|
11+
LL | let _: Option<u64> = Some(&16).cloned();
12+
| ~~~~~~~~~~~~~~~~~~
913

1014
error: aborting due to 1 previous error
1115

src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.stderr

+35-6
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,69 @@ error: this import should be renamed
22
--> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:5:20
33
|
44
LL | use std::process::{exit as wrong_exit, Child as Kid};
5-
| ^^^^^^^^^^^^^^^^^^ help: try: `exit as goodbye`
5+
| ^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::missing-enforced-import-renames` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::missing_enforced_import_renames)]`
9+
help: try
10+
|
11+
LL | use std::process::{exit as goodbye, Child as Kid};
12+
| ~~~~~~~~~~~~~~~
913

1014
error: this import should be renamed
1115
--> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:6:1
1216
|
1317
LL | use std::thread::sleep;
14-
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `use std::thread::sleep as thread_sleep`
18+
| ^^^^^^^^^^^^^^^^^^^^^^
19+
|
20+
help: try
21+
|
22+
LL | use std::thread::sleep as thread_sleep;
23+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1524

1625
error: this import should be renamed
1726
--> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:9:11
1827
|
1928
LL | any::{type_name, Any},
20-
| ^^^^^^^^^ help: try: `type_name as ident`
29+
| ^^^^^^^^^
30+
|
31+
help: try
32+
|
33+
LL | any::{type_name as ident, Any},
34+
| ~~~~~~~~~~~~~~~~~~
2135

2236
error: this import should be renamed
2337
--> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:10:5
2438
|
2539
LL | clone,
26-
| ^^^^^ help: try: `clone as foo`
40+
| ^^^^^
41+
|
42+
help: try
43+
|
44+
LL | clone as foo,
45+
| ~~~~~~~~~~~~
2746

2847
error: this import should be renamed
2948
--> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:11:5
3049
|
3150
LL | sync :: Mutex,
32-
| ^^^^^^^^^^^^^ help: try: `sync :: Mutex as StdMutie`
51+
| ^^^^^^^^^^^^^
52+
|
53+
help: try
54+
|
55+
LL | sync :: Mutex as StdMutie,
56+
| ~~~~~~~~~~~~~~~~~~~~~~~~~
3357

3458
error: this import should be renamed
3559
--> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:15:5
3660
|
3761
LL | use std::collections::BTreeMap as OopsWrongRename;
38-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `use std::collections::BTreeMap as Map`
62+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63+
|
64+
help: try
65+
|
66+
LL | use std::collections::BTreeMap as Map;
67+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3968

4069
error: aborting due to 6 previous errors
4170

src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.stderr

+46-8
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,95 @@ error: use of irregular braces for `vec!` macro
22
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:43:13
33
|
44
LL | let _ = vec! {1, 2, 3};
5-
| ^^^^^^^^^^^^^^ help: consider writing: `vec![1, 2, 3]`
5+
| ^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::nonstandard_macro_braces)]`
9+
help: consider writing
10+
|
11+
LL | let _ = vec![1, 2, 3];
12+
| ~~~~~~~~~~~~~
913

1014
error: use of irregular braces for `format!` macro
1115
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:44:13
1216
|
1317
LL | let _ = format!["ugh {} stop being such a good compiler", "hello"];
14-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `format!("ugh {} stop being such a good compiler", "hello")`
18+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19+
|
20+
help: consider writing
21+
|
22+
LL | let _ = format!("ugh {} stop being such a good compiler", "hello");
23+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1524

1625
error: use of irregular braces for `matches!` macro
1726
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:45:13
1827
|
1928
LL | let _ = matches!{{}, ()};
20-
| ^^^^^^^^^^^^^^^^ help: consider writing: `matches!({}, ())`
29+
| ^^^^^^^^^^^^^^^^
30+
|
31+
help: consider writing
32+
|
33+
LL | let _ = matches!({}, ());
34+
| ~~~~~~~~~~~~~~~~
2135

2236
error: use of irregular braces for `quote!` macro
2337
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:46:13
2438
|
2539
LL | let _ = quote!(let x = 1;);
26-
| ^^^^^^^^^^^^^^^^^^ help: consider writing: `quote!{let x = 1;}`
40+
| ^^^^^^^^^^^^^^^^^^
41+
|
42+
help: consider writing
43+
|
44+
LL | let _ = quote!{let x = 1;};
45+
| ~~~~~~~~~~~~~~~~~~
2746

2847
error: use of irregular braces for `quote::quote!` macro
2948
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:47:13
3049
|
3150
LL | let _ = quote::quote!(match match match);
32-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `quote::quote!{match match match}`
51+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52+
|
53+
help: consider writing
54+
|
55+
LL | let _ = quote::quote!{match match match};
56+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3357

3458
error: use of irregular braces for `vec!` macro
3559
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:18:9
3660
|
3761
LL | vec!{0, 0, 0}
38-
| ^^^^^^^^^^^^^ help: consider writing: `vec![0, 0, 0]`
62+
| ^^^^^^^^^^^^^
3963
...
4064
LL | let _ = test!(); // trigger when macro def is inside our own crate
4165
| ------- in this macro invocation
4266
|
4367
= note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
68+
help: consider writing
69+
|
70+
LL | vec![0, 0, 0]
71+
|
4472

4573
error: use of irregular braces for `type_pos!` macro
4674
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:56:12
4775
|
4876
LL | let _: type_pos!(usize) = vec![];
49-
| ^^^^^^^^^^^^^^^^ help: consider writing: `type_pos![usize]`
77+
| ^^^^^^^^^^^^^^^^
78+
|
79+
help: consider writing
80+
|
81+
LL | let _: type_pos![usize] = vec![];
82+
| ~~~~~~~~~~~~~~~~
5083

5184
error: use of irregular braces for `eprint!` macro
5285
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:58:5
5386
|
5487
LL | eprint!("test if user config overrides defaults");
55-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `eprint!["test if user config overrides defaults"]`
88+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
89+
|
90+
help: consider writing
91+
|
92+
LL | eprint!["test if user config overrides defaults"];
93+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5694

5795
error: aborting due to 8 previous errors
5896

src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.stderr

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,25 @@ error: this argument (N byte) is passed by reference, but would be more efficien
22
--> tests/ui-toml/toml_trivially_copy/test.rs:15:11
33
|
44
LL | fn bad(x: &u16, y: &Foo) {}
5-
| ^^^^ help: consider passing by value instead: `u16`
5+
| ^^^^
66
|
77
= note: `-D clippy::trivially-copy-pass-by-ref` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::trivially_copy_pass_by_ref)]`
9+
help: consider passing by value instead
10+
|
11+
LL | fn bad(x: u16, y: &Foo) {}
12+
| ~~~
913

1014
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
1115
--> tests/ui-toml/toml_trivially_copy/test.rs:15:20
1216
|
1317
LL | fn bad(x: &u16, y: &Foo) {}
14-
| ^^^^ help: consider passing by value instead: `Foo`
18+
| ^^^^
19+
|
20+
help: consider passing by value instead
21+
|
22+
LL | fn bad(x: &u16, y: Foo) {}
23+
| ~~~
1524

1625
error: aborting due to 2 previous errors
1726

src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr

+6-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,12 @@ error: error reading Clippy's configuration file: unknown field `allow_mixed_uni
248248
--> $DIR/tests/ui-toml/toml_unknown_key/clippy.toml:7:1
249249
|
250250
LL | allow_mixed_uninlined_format_args = true
251-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: perhaps you meant: `allow-mixed-uninlined-format-args`
251+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
252+
|
253+
help: perhaps you meant
254+
|
255+
LL | allow-mixed-uninlined-format-args = true
256+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252257

253258
error: aborting due to 3 previous errors
254259

0 commit comments

Comments
 (0)