Skip to content

Commit

Permalink
Make the default suggestions show the full patch output
Browse files Browse the repository at this point in the history
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';
   |                       ~~~
```
  • Loading branch information
estebank committed Jul 3, 2024
1 parent 1cfd47f commit ba252ed
Show file tree
Hide file tree
Showing 863 changed files with 30,276 additions and 7,079 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
msg,
suggestion,
applicability,
SuggestionStyle::ShowCode,
SuggestionStyle::ShowAlways,
);
self
} }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ error: large array defined as const
--> tests/ui-toml/array_size_threshold/array_size_threshold.rs:4:1
|
LL | const ABOVE: [u8; 11] = [0; 11];
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| help: make this a static item: `static`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::large-const-arrays` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::large_const_arrays)]`
help: make this a static item
|
LL | static ABOVE: [u8; 11] = [0; 11];
| ~~~~~~

error: allocating a local array larger than 10 bytes
--> tests/ui-toml/array_size_threshold/array_size_threshold.rs:4:25
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ error: integer literal has a better hexadecimal representation
--> tests/ui-toml/decimal_literal_representation/decimal_literal_representation.rs:4:13
|
LL | let _ = 16777215;
| ^^^^^^^^ help: consider: `0x00FF_FFFF`
| ^^^^^^^^
|
= note: `-D clippy::decimal-literal-representation` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::decimal_literal_representation)]`
help: consider
|
LL | let _ = 0x00FF_FFFF;
| ~~~~~~~~~~~

error: aborting due to 1 previous error

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

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

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ error: large future with a size of 1026 bytes
--> tests/ui-toml/large_futures/large_futures.rs:18:5
|
LL | should_warn().await;
| ^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(should_warn())`
| ^^^^^^^^^^^^^
|
= note: `-D clippy::large-futures` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::large_futures)]`
help: consider `Box::pin` on it
|
LL | Box::pin(should_warn()).await;
| ~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to 1 previous error

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

error: aborting due to 1 previous error

Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@ error: digits grouped inconsistently by underscores
--> tests/ui-toml/lint_decimal_readability/test.rs:19:18
|
LL | let _fail1 = 100_200_300.123456789;
| ^^^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.123_456_789`
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::inconsistent_digit_grouping)]`
help: consider
|
LL | let _fail1 = 100_200_300.123_456_789;
| ~~~~~~~~~~~~~~~~~~~~~~~

error: long literal lacking separators
--> tests/ui-toml/lint_decimal_readability/test.rs:22:18
|
LL | let _fail2 = 100200300.300200100;
| ^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.300_200_100`
| ^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::unreadable-literal` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::unreadable_literal)]`
help: consider
|
LL | let _fail2 = 100_200_300.300_200_100;
| ~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ LL | |
LL | | Foo::A(x) => x,
LL | | Foo::B => return,
LL | | };
| |______^ help: consider writing: `let Foo::A(x) = Foo::A(1) else { return };`
| |______^
|
= note: `-D clippy::manual-let-else` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::manual_let_else)]`
help: consider writing
|
LL | let Foo::A(x) = Foo::A(1) else { return };
|

error: aborting due to 1 previous error

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

error: aborting due to 1 previous error

Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,69 @@ error: this import should be renamed
--> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:5:20
|
LL | use std::process::{exit as wrong_exit, Child as Kid};
| ^^^^^^^^^^^^^^^^^^ help: try: `exit as goodbye`
| ^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::missing-enforced-import-renames` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::missing_enforced_import_renames)]`
help: try
|
LL | use std::process::{exit as goodbye, Child as Kid};
| ~~~~~~~~~~~~~~~

error: this import should be renamed
--> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:6:1
|
LL | use std::thread::sleep;
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `use std::thread::sleep as thread_sleep`
| ^^^^^^^^^^^^^^^^^^^^^^
|
help: try
|
LL | use std::thread::sleep as thread_sleep;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: this import should be renamed
--> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:9:11
|
LL | any::{type_name, Any},
| ^^^^^^^^^ help: try: `type_name as ident`
| ^^^^^^^^^
|
help: try
|
LL | any::{type_name as ident, Any},
| ~~~~~~~~~~~~~~~~~~

error: this import should be renamed
--> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:10:5
|
LL | clone,
| ^^^^^ help: try: `clone as foo`
| ^^^^^
|
help: try
|
LL | clone as foo,
| ~~~~~~~~~~~~

error: this import should be renamed
--> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:11:5
|
LL | sync :: Mutex,
| ^^^^^^^^^^^^^ help: try: `sync :: Mutex as StdMutie`
| ^^^^^^^^^^^^^
|
help: try
|
LL | sync :: Mutex as StdMutie,
| ~~~~~~~~~~~~~~~~~~~~~~~~~

error: this import should be renamed
--> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:15:5
|
LL | use std::collections::BTreeMap as OopsWrongRename;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `use std::collections::BTreeMap as Map`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: try
|
LL | use std::collections::BTreeMap as Map;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to 6 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,95 @@ error: use of irregular braces for `vec!` macro
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:43:13
|
LL | let _ = vec! {1, 2, 3};
| ^^^^^^^^^^^^^^ help: consider writing: `vec![1, 2, 3]`
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::nonstandard_macro_braces)]`
help: consider writing
|
LL | let _ = vec![1, 2, 3];
| ~~~~~~~~~~~~~

error: use of irregular braces for `format!` macro
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:44:13
|
LL | let _ = format!["ugh {} stop being such a good compiler", "hello"];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `format!("ugh {} stop being such a good compiler", "hello")`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider writing
|
LL | let _ = format!("ugh {} stop being such a good compiler", "hello");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: use of irregular braces for `matches!` macro
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:45:13
|
LL | let _ = matches!{{}, ()};
| ^^^^^^^^^^^^^^^^ help: consider writing: `matches!({}, ())`
| ^^^^^^^^^^^^^^^^
|
help: consider writing
|
LL | let _ = matches!({}, ());
| ~~~~~~~~~~~~~~~~

error: use of irregular braces for `quote!` macro
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:46:13
|
LL | let _ = quote!(let x = 1;);
| ^^^^^^^^^^^^^^^^^^ help: consider writing: `quote!{let x = 1;}`
| ^^^^^^^^^^^^^^^^^^
|
help: consider writing
|
LL | let _ = quote!{let x = 1;};
| ~~~~~~~~~~~~~~~~~~

error: use of irregular braces for `quote::quote!` macro
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:47:13
|
LL | let _ = quote::quote!(match match match);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `quote::quote!{match match match}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider writing
|
LL | let _ = quote::quote!{match match match};
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: use of irregular braces for `vec!` macro
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:18:9
|
LL | vec!{0, 0, 0}
| ^^^^^^^^^^^^^ help: consider writing: `vec![0, 0, 0]`
| ^^^^^^^^^^^^^
...
LL | let _ = test!(); // trigger when macro def is inside our own crate
| ------- in this macro invocation
|
= note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider writing
|
LL | vec![0, 0, 0]
|

error: use of irregular braces for `type_pos!` macro
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:56:12
|
LL | let _: type_pos!(usize) = vec![];
| ^^^^^^^^^^^^^^^^ help: consider writing: `type_pos![usize]`
| ^^^^^^^^^^^^^^^^
|
help: consider writing
|
LL | let _: type_pos![usize] = vec![];
| ~~~~~~~~~~~~~~~~

error: use of irregular braces for `eprint!` macro
--> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:58:5
|
LL | eprint!("test if user config overrides defaults");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `eprint!["test if user config overrides defaults"]`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider writing
|
LL | eprint!["test if user config overrides defaults"];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to 8 previous errors

13 changes: 11 additions & 2 deletions src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@ error: this argument (N byte) is passed by reference, but would be more efficien
--> tests/ui-toml/toml_trivially_copy/test.rs:15:11
|
LL | fn bad(x: &u16, y: &Foo) {}
| ^^^^ help: consider passing by value instead: `u16`
| ^^^^
|
= note: `-D clippy::trivially-copy-pass-by-ref` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::trivially_copy_pass_by_ref)]`
help: consider passing by value instead
|
LL | fn bad(x: u16, y: &Foo) {}
| ~~~

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

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,12 @@ error: error reading Clippy's configuration file: unknown field `allow_mixed_uni
--> $DIR/tests/ui-toml/toml_unknown_key/clippy.toml:7:1
|
LL | allow_mixed_uninlined_format_args = true
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: perhaps you meant: `allow-mixed-uninlined-format-args`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: perhaps you meant
|
LL | allow-mixed-uninlined-format-args = true
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to 3 previous errors

Loading

0 comments on commit ba252ed

Please sign in to comment.