More sophisticated span trimming

This commit is contained in:
Michael Goulet 2025-02-20 23:05:38 +00:00
parent a81c2648dc
commit fef0ea905a
6 changed files with 80 additions and 121 deletions

View file

@ -13,9 +13,8 @@ LL + let x: &str = s;
|
help: if you would like to deref, try using `&**`
|
LL - let x: &str = &*s;
LL + let x: &str = &**s;
|
LL | let x: &str = &**s;
| +
error: aborting due to 1 previous error

View file

@ -8,9 +8,8 @@ LL | let _ = foo as i8;
= help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast_any)]`
help: did you mean to invoke the function?
|
LL - let _ = foo as i8;
LL + let _ = foo() as i8;
|
LL | let _ = foo() as i8;
| ++
error: casting function pointer `foo` to `i16`
--> tests/ui/fn_to_numeric_cast_any.rs:26:13
@ -20,9 +19,8 @@ LL | let _ = foo as i16;
|
help: did you mean to invoke the function?
|
LL - let _ = foo as i16;
LL + let _ = foo() as i16;
|
LL | let _ = foo() as i16;
| ++
error: casting function pointer `foo` to `i32`
--> tests/ui/fn_to_numeric_cast_any.rs:28:13
@ -32,9 +30,8 @@ LL | let _ = foo as i32;
|
help: did you mean to invoke the function?
|
LL - let _ = foo as i32;
LL + let _ = foo() as i32;
|
LL | let _ = foo() as i32;
| ++
error: casting function pointer `foo` to `i64`
--> tests/ui/fn_to_numeric_cast_any.rs:30:13
@ -44,9 +41,8 @@ LL | let _ = foo as i64;
|
help: did you mean to invoke the function?
|
LL - let _ = foo as i64;
LL + let _ = foo() as i64;
|
LL | let _ = foo() as i64;
| ++
error: casting function pointer `foo` to `i128`
--> tests/ui/fn_to_numeric_cast_any.rs:32:13
@ -56,9 +52,8 @@ LL | let _ = foo as i128;
|
help: did you mean to invoke the function?
|
LL - let _ = foo as i128;
LL + let _ = foo() as i128;
|
LL | let _ = foo() as i128;
| ++
error: casting function pointer `foo` to `isize`
--> tests/ui/fn_to_numeric_cast_any.rs:34:13
@ -68,9 +63,8 @@ LL | let _ = foo as isize;
|
help: did you mean to invoke the function?
|
LL - let _ = foo as isize;
LL + let _ = foo() as isize;
|
LL | let _ = foo() as isize;
| ++
error: casting function pointer `foo` to `u8`
--> tests/ui/fn_to_numeric_cast_any.rs:37:13
@ -80,9 +74,8 @@ LL | let _ = foo as u8;
|
help: did you mean to invoke the function?
|
LL - let _ = foo as u8;
LL + let _ = foo() as u8;
|
LL | let _ = foo() as u8;
| ++
error: casting function pointer `foo` to `u16`
--> tests/ui/fn_to_numeric_cast_any.rs:39:13
@ -92,9 +85,8 @@ LL | let _ = foo as u16;
|
help: did you mean to invoke the function?
|
LL - let _ = foo as u16;
LL + let _ = foo() as u16;
|
LL | let _ = foo() as u16;
| ++
error: casting function pointer `foo` to `u32`
--> tests/ui/fn_to_numeric_cast_any.rs:41:13
@ -104,9 +96,8 @@ LL | let _ = foo as u32;
|
help: did you mean to invoke the function?
|
LL - let _ = foo as u32;
LL + let _ = foo() as u32;
|
LL | let _ = foo() as u32;
| ++
error: casting function pointer `foo` to `u64`
--> tests/ui/fn_to_numeric_cast_any.rs:43:13
@ -116,9 +107,8 @@ LL | let _ = foo as u64;
|
help: did you mean to invoke the function?
|
LL - let _ = foo as u64;
LL + let _ = foo() as u64;
|
LL | let _ = foo() as u64;
| ++
error: casting function pointer `foo` to `u128`
--> tests/ui/fn_to_numeric_cast_any.rs:45:13
@ -128,9 +118,8 @@ LL | let _ = foo as u128;
|
help: did you mean to invoke the function?
|
LL - let _ = foo as u128;
LL + let _ = foo() as u128;
|
LL | let _ = foo() as u128;
| ++
error: casting function pointer `foo` to `usize`
--> tests/ui/fn_to_numeric_cast_any.rs:47:13
@ -140,9 +129,8 @@ LL | let _ = foo as usize;
|
help: did you mean to invoke the function?
|
LL - let _ = foo as usize;
LL + let _ = foo() as usize;
|
LL | let _ = foo() as usize;
| ++
error: casting function pointer `Struct::static_method` to `usize`
--> tests/ui/fn_to_numeric_cast_any.rs:52:13
@ -152,9 +140,8 @@ LL | let _ = Struct::static_method as usize;
|
help: did you mean to invoke the function?
|
LL - let _ = Struct::static_method as usize;
LL + let _ = Struct::static_method() as usize;
|
LL | let _ = Struct::static_method() as usize;
| ++
error: casting function pointer `f` to `usize`
--> tests/ui/fn_to_numeric_cast_any.rs:57:5
@ -164,8 +151,7 @@ LL | f as usize
|
help: did you mean to invoke the function?
|
LL - f as usize
LL + f() as usize
LL | f() as usize
|
error: casting function pointer `T::static_method` to `usize`
@ -176,8 +162,7 @@ LL | T::static_method as usize
|
help: did you mean to invoke the function?
|
LL - T::static_method as usize
LL + T::static_method() as usize
LL | T::static_method() as usize
|
error: casting function pointer `(clos as fn(u32) -> u32)` to `usize`
@ -188,9 +173,8 @@ LL | let _ = (clos as fn(u32) -> u32) as usize;
|
help: did you mean to invoke the function?
|
LL - let _ = (clos as fn(u32) -> u32) as usize;
LL + let _ = (clos as fn(u32) -> u32)() as usize;
|
LL | let _ = (clos as fn(u32) -> u32)() as usize;
| ++
error: casting function pointer `foo` to `*const ()`
--> tests/ui/fn_to_numeric_cast_any.rs:74:13
@ -200,9 +184,8 @@ LL | let _ = foo as *const ();
|
help: did you mean to invoke the function?
|
LL - let _ = foo as *const ();
LL + let _ = foo() as *const ();
|
LL | let _ = foo() as *const ();
| ++
error: aborting due to 17 previous errors

View file

@ -78,9 +78,8 @@ LL | pub fn map(map: &mut HashMap<i32, i32>) {}
|
help: add a type parameter for `BuildHasher`
|
LL - pub fn map(map: &mut HashMap<i32, i32>) {}
LL + pub fn map<S: ::std::hash::BuildHasher>(map: &mut HashMap<i32, i32, S>) {}
|
LL | pub fn map<S: ::std::hash::BuildHasher>(map: &mut HashMap<i32, i32, S>) {}
| +++++++++++++++++++++++++++++ +++
error: parameter of type `HashSet` should be generalized over different hashers
--> tests/ui/implicit_hasher.rs:70:22
@ -90,9 +89,8 @@ LL | pub fn set(set: &mut HashSet<i32>) {}
|
help: add a type parameter for `BuildHasher`
|
LL - pub fn set(set: &mut HashSet<i32>) {}
LL + pub fn set<S: ::std::hash::BuildHasher>(set: &mut HashSet<i32, S>) {}
|
LL | pub fn set<S: ::std::hash::BuildHasher>(set: &mut HashSet<i32, S>) {}
| +++++++++++++++++++++++++++++ +++
error: impl for `HashMap` should be generalized over different hashers
--> tests/ui/implicit_hasher.rs:76:43
@ -116,9 +114,8 @@ LL | pub async fn election_vote(_data: HashMap<i32, i32>) {}
|
help: add a type parameter for `BuildHasher`
|
LL - pub async fn election_vote(_data: HashMap<i32, i32>) {}
LL + pub async fn election_vote<S: ::std::hash::BuildHasher>(_data: HashMap<i32, i32, S>) {}
|
LL | pub async fn election_vote<S: ::std::hash::BuildHasher>(_data: HashMap<i32, i32, S>) {}
| +++++++++++++++++++++++++++++ +++
error: aborting due to 9 previous errors

View file

@ -99,9 +99,8 @@ LL + let fail8 = 123;
|
help: if you mean to use an octal constant, use `0o`
|
LL - let fail8 = 0123;
LL + let fail8 = 0o123;
|
LL | let fail8 = 0o123;
| +
error: integer type suffix should not be separated by an underscore
--> tests/ui/literals.rs:48:16

View file

@ -14,9 +14,8 @@ LL + let _bad1 = "\x1b[0m";
|
help: if a null escape is intended, disambiguate using
|
LL - let _bad1 = "\033[0m";
LL + let _bad1 = "\x0033[0m";
|
LL | let _bad1 = "\x0033[0m";
| ++
error: octal-looking escape in a literal
--> tests/ui/octal_escapes.rs:6:19
@ -31,9 +30,8 @@ LL + let _bad2 = b"\x1b[0m";
|
help: if a null escape is intended, disambiguate using
|
LL - let _bad2 = b"\033[0m";
LL + let _bad2 = b"\x0033[0m";
|
LL | let _bad2 = b"\x0033[0m";
| ++
error: octal-looking escape in a literal
--> tests/ui/octal_escapes.rs:7:20
@ -48,9 +46,8 @@ LL + let _bad3 = "\\\x1b[0m";
|
help: if a null escape is intended, disambiguate using
|
LL - let _bad3 = "\\\033[0m";
LL + let _bad3 = "\\\x0033[0m";
|
LL | let _bad3 = "\\\x0033[0m";
| ++
error: octal-looking escape in a literal
--> tests/ui/octal_escapes.rs:9:18
@ -65,9 +62,8 @@ LL + let _bad4 = "\x0a34567";
|
help: if a null escape is intended, disambiguate using
|
LL - let _bad4 = "\01234567";
LL + let _bad4 = "\x001234567";
|
LL | let _bad4 = "\x001234567";
| ++
error: octal-looking escape in a literal
--> tests/ui/octal_escapes.rs:10:20
@ -77,14 +73,12 @@ LL | let _bad5 = "\0\03";
|
help: if an octal escape is intended, use a hex escape instead
|
LL - let _bad5 = "\0\03";
LL + let _bad5 = "\0\x03";
|
LL | let _bad5 = "\0\x03";
| +
help: if a null escape is intended, disambiguate using
|
LL - let _bad5 = "\0\03";
LL + let _bad5 = "\0\x0003";
|
LL | let _bad5 = "\0\x0003";
| +++
error: octal-looking escape in a literal
--> tests/ui/octal_escapes.rs:11:23
@ -99,9 +93,8 @@ LL + let _bad6 = "Text-\x2d\077-MoreText";
|
help: if a null escape is intended, disambiguate using
|
LL - let _bad6 = "Text-\055\077-MoreText";
LL + let _bad6 = "Text-\x0055\077-MoreText";
|
LL | let _bad6 = "Text-\x0055\077-MoreText";
| ++
error: octal-looking escape in a literal
--> tests/ui/octal_escapes.rs:11:27
@ -116,9 +109,8 @@ LL + let _bad6 = "Text-\055\x3f-MoreText";
|
help: if a null escape is intended, disambiguate using
|
LL - let _bad6 = "Text-\055\077-MoreText";
LL + let _bad6 = "Text-\055\x0077-MoreText";
|
LL | let _bad6 = "Text-\055\x0077-MoreText";
| ++
error: octal-looking escape in a literal
--> tests/ui/octal_escapes.rs:14:31
@ -128,14 +120,12 @@ LL | let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
|
help: if an octal escape is intended, use a hex escape instead
|
LL - let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
LL + let _bad7 = "EvenMoreText-\x01\02-ShortEscapes";
|
LL | let _bad7 = "EvenMoreText-\x01\02-ShortEscapes";
| +
help: if a null escape is intended, disambiguate using
|
LL - let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
LL + let _bad7 = "EvenMoreText-\x0001\02-ShortEscapes";
|
LL | let _bad7 = "EvenMoreText-\x0001\02-ShortEscapes";
| +++
error: octal-looking escape in a literal
--> tests/ui/octal_escapes.rs:14:34
@ -145,14 +135,12 @@ LL | let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
|
help: if an octal escape is intended, use a hex escape instead
|
LL - let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
LL + let _bad7 = "EvenMoreText-\01\x02-ShortEscapes";
|
LL | let _bad7 = "EvenMoreText-\01\x02-ShortEscapes";
| +
help: if a null escape is intended, disambiguate using
|
LL - let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
LL + let _bad7 = "EvenMoreText-\01\x0002-ShortEscapes";
|
LL | let _bad7 = "EvenMoreText-\01\x0002-ShortEscapes";
| +++
error: octal-looking escape in a literal
--> tests/ui/octal_escapes.rs:17:19
@ -162,14 +150,12 @@ LL | let _bad8 = "锈\01锈";
|
help: if an octal escape is intended, use a hex escape instead
|
LL - let _bad8 = "锈\01锈";
LL + let _bad8 = "锈\x01锈";
|
LL | let _bad8 = "锈\x01锈";
| +
help: if a null escape is intended, disambiguate using
|
LL - let _bad8 = "锈\01锈";
LL + let _bad8 = "锈\x0001锈";
|
LL | let _bad8 = "锈\x0001锈";
| +++
error: octal-looking escape in a literal
--> tests/ui/octal_escapes.rs:18:19
@ -184,9 +170,8 @@ LL + let _bad9 = "锈\x09锈";
|
help: if a null escape is intended, disambiguate using
|
LL - let _bad9 = "锈\011锈";
LL + let _bad9 = "锈\x0011锈";
|
LL | let _bad9 = "锈\x0011锈";
| ++
error: aborting due to 11 previous errors

View file

@ -8,9 +8,8 @@ LL | let _ = cow.to_owned();
= help: to override `-D warnings` add `#[allow(clippy::suspicious_to_owned)]`
help: depending on intent, either make the Cow an Owned variant
|
LL - let _ = cow.to_owned();
LL + let _ = cow.into_owned();
|
LL | let _ = cow.into_owned();
| ++
help: or clone the Cow itself
|
LL - let _ = cow.to_owned();
@ -25,9 +24,8 @@ LL | let _ = cow.to_owned();
|
help: depending on intent, either make the Cow an Owned variant
|
LL - let _ = cow.to_owned();
LL + let _ = cow.into_owned();
|
LL | let _ = cow.into_owned();
| ++
help: or clone the Cow itself
|
LL - let _ = cow.to_owned();
@ -42,9 +40,8 @@ LL | let _ = cow.to_owned();
|
help: depending on intent, either make the Cow an Owned variant
|
LL - let _ = cow.to_owned();
LL + let _ = cow.into_owned();
|
LL | let _ = cow.into_owned();
| ++
help: or clone the Cow itself
|
LL - let _ = cow.to_owned();
@ -59,9 +56,8 @@ LL | let _ = cow.to_owned();
|
help: depending on intent, either make the Cow an Owned variant
|
LL - let _ = cow.to_owned();
LL + let _ = cow.into_owned();
|
LL | let _ = cow.into_owned();
| ++
help: or clone the Cow itself
|
LL - let _ = cow.to_owned();