Skip to content

Commit

Permalink
More sophisticated span trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Feb 21, 2025
1 parent a81c264 commit fef0ea9
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 121 deletions.
5 changes: 2 additions & 3 deletions tests/ui/borrow_deref_ref_unfixable.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

81 changes: 32 additions & 49 deletions tests/ui/fn_to_numeric_cast_any.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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`
Expand All @@ -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`
Expand All @@ -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
Expand All @@ -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

15 changes: 6 additions & 9 deletions tests/ui/implicit_hasher.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

5 changes: 2 additions & 3 deletions tests/ui/literals.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit fef0ea9

Please sign in to comment.