Skip to content

Commit fef0ea9

Browse files
More sophisticated span trimming
1 parent a81c264 commit fef0ea9

6 files changed

+80
-121
lines changed

tests/ui/borrow_deref_ref_unfixable.stderr

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ LL + let x: &str = s;
1313
|
1414
help: if you would like to deref, try using `&**`
1515
|
16-
LL - let x: &str = &*s;
17-
LL + let x: &str = &**s;
18-
|
16+
LL | let x: &str = &**s;
17+
| +
1918

2019
error: aborting due to 1 previous error
2120

tests/ui/fn_to_numeric_cast_any.stderr

+32-49
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ LL | let _ = foo as i8;
88
= help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast_any)]`
99
help: did you mean to invoke the function?
1010
|
11-
LL - let _ = foo as i8;
12-
LL + let _ = foo() as i8;
13-
|
11+
LL | let _ = foo() as i8;
12+
| ++
1413

1514
error: casting function pointer `foo` to `i16`
1615
--> tests/ui/fn_to_numeric_cast_any.rs:26:13
@@ -20,9 +19,8 @@ LL | let _ = foo as i16;
2019
|
2120
help: did you mean to invoke the function?
2221
|
23-
LL - let _ = foo as i16;
24-
LL + let _ = foo() as i16;
25-
|
22+
LL | let _ = foo() as i16;
23+
| ++
2624

2725
error: casting function pointer `foo` to `i32`
2826
--> tests/ui/fn_to_numeric_cast_any.rs:28:13
@@ -32,9 +30,8 @@ LL | let _ = foo as i32;
3230
|
3331
help: did you mean to invoke the function?
3432
|
35-
LL - let _ = foo as i32;
36-
LL + let _ = foo() as i32;
37-
|
33+
LL | let _ = foo() as i32;
34+
| ++
3835

3936
error: casting function pointer `foo` to `i64`
4037
--> tests/ui/fn_to_numeric_cast_any.rs:30:13
@@ -44,9 +41,8 @@ LL | let _ = foo as i64;
4441
|
4542
help: did you mean to invoke the function?
4643
|
47-
LL - let _ = foo as i64;
48-
LL + let _ = foo() as i64;
49-
|
44+
LL | let _ = foo() as i64;
45+
| ++
5046

5147
error: casting function pointer `foo` to `i128`
5248
--> tests/ui/fn_to_numeric_cast_any.rs:32:13
@@ -56,9 +52,8 @@ LL | let _ = foo as i128;
5652
|
5753
help: did you mean to invoke the function?
5854
|
59-
LL - let _ = foo as i128;
60-
LL + let _ = foo() as i128;
61-
|
55+
LL | let _ = foo() as i128;
56+
| ++
6257

6358
error: casting function pointer `foo` to `isize`
6459
--> tests/ui/fn_to_numeric_cast_any.rs:34:13
@@ -68,9 +63,8 @@ LL | let _ = foo as isize;
6863
|
6964
help: did you mean to invoke the function?
7065
|
71-
LL - let _ = foo as isize;
72-
LL + let _ = foo() as isize;
73-
|
66+
LL | let _ = foo() as isize;
67+
| ++
7468

7569
error: casting function pointer `foo` to `u8`
7670
--> tests/ui/fn_to_numeric_cast_any.rs:37:13
@@ -80,9 +74,8 @@ LL | let _ = foo as u8;
8074
|
8175
help: did you mean to invoke the function?
8276
|
83-
LL - let _ = foo as u8;
84-
LL + let _ = foo() as u8;
85-
|
77+
LL | let _ = foo() as u8;
78+
| ++
8679

8780
error: casting function pointer `foo` to `u16`
8881
--> tests/ui/fn_to_numeric_cast_any.rs:39:13
@@ -92,9 +85,8 @@ LL | let _ = foo as u16;
9285
|
9386
help: did you mean to invoke the function?
9487
|
95-
LL - let _ = foo as u16;
96-
LL + let _ = foo() as u16;
97-
|
88+
LL | let _ = foo() as u16;
89+
| ++
9890

9991
error: casting function pointer `foo` to `u32`
10092
--> tests/ui/fn_to_numeric_cast_any.rs:41:13
@@ -104,9 +96,8 @@ LL | let _ = foo as u32;
10496
|
10597
help: did you mean to invoke the function?
10698
|
107-
LL - let _ = foo as u32;
108-
LL + let _ = foo() as u32;
109-
|
99+
LL | let _ = foo() as u32;
100+
| ++
110101

111102
error: casting function pointer `foo` to `u64`
112103
--> tests/ui/fn_to_numeric_cast_any.rs:43:13
@@ -116,9 +107,8 @@ LL | let _ = foo as u64;
116107
|
117108
help: did you mean to invoke the function?
118109
|
119-
LL - let _ = foo as u64;
120-
LL + let _ = foo() as u64;
121-
|
110+
LL | let _ = foo() as u64;
111+
| ++
122112

123113
error: casting function pointer `foo` to `u128`
124114
--> tests/ui/fn_to_numeric_cast_any.rs:45:13
@@ -128,9 +118,8 @@ LL | let _ = foo as u128;
128118
|
129119
help: did you mean to invoke the function?
130120
|
131-
LL - let _ = foo as u128;
132-
LL + let _ = foo() as u128;
133-
|
121+
LL | let _ = foo() as u128;
122+
| ++
134123

135124
error: casting function pointer `foo` to `usize`
136125
--> tests/ui/fn_to_numeric_cast_any.rs:47:13
@@ -140,9 +129,8 @@ LL | let _ = foo as usize;
140129
|
141130
help: did you mean to invoke the function?
142131
|
143-
LL - let _ = foo as usize;
144-
LL + let _ = foo() as usize;
145-
|
132+
LL | let _ = foo() as usize;
133+
| ++
146134

147135
error: casting function pointer `Struct::static_method` to `usize`
148136
--> tests/ui/fn_to_numeric_cast_any.rs:52:13
@@ -152,9 +140,8 @@ LL | let _ = Struct::static_method as usize;
152140
|
153141
help: did you mean to invoke the function?
154142
|
155-
LL - let _ = Struct::static_method as usize;
156-
LL + let _ = Struct::static_method() as usize;
157-
|
143+
LL | let _ = Struct::static_method() as usize;
144+
| ++
158145

159146
error: casting function pointer `f` to `usize`
160147
--> tests/ui/fn_to_numeric_cast_any.rs:57:5
@@ -164,8 +151,7 @@ LL | f as usize
164151
|
165152
help: did you mean to invoke the function?
166153
|
167-
LL - f as usize
168-
LL + f() as usize
154+
LL | f() as usize
169155
|
170156

171157
error: casting function pointer `T::static_method` to `usize`
@@ -176,8 +162,7 @@ LL | T::static_method as usize
176162
|
177163
help: did you mean to invoke the function?
178164
|
179-
LL - T::static_method as usize
180-
LL + T::static_method() as usize
165+
LL | T::static_method() as usize
181166
|
182167

183168
error: casting function pointer `(clos as fn(u32) -> u32)` to `usize`
@@ -188,9 +173,8 @@ LL | let _ = (clos as fn(u32) -> u32) as usize;
188173
|
189174
help: did you mean to invoke the function?
190175
|
191-
LL - let _ = (clos as fn(u32) -> u32) as usize;
192-
LL + let _ = (clos as fn(u32) -> u32)() as usize;
193-
|
176+
LL | let _ = (clos as fn(u32) -> u32)() as usize;
177+
| ++
194178

195179
error: casting function pointer `foo` to `*const ()`
196180
--> tests/ui/fn_to_numeric_cast_any.rs:74:13
@@ -200,9 +184,8 @@ LL | let _ = foo as *const ();
200184
|
201185
help: did you mean to invoke the function?
202186
|
203-
LL - let _ = foo as *const ();
204-
LL + let _ = foo() as *const ();
205-
|
187+
LL | let _ = foo() as *const ();
188+
| ++
206189

207190
error: aborting due to 17 previous errors
208191

tests/ui/implicit_hasher.stderr

+6-9
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,8 @@ LL | pub fn map(map: &mut HashMap<i32, i32>) {}
7878
|
7979
help: add a type parameter for `BuildHasher`
8080
|
81-
LL - pub fn map(map: &mut HashMap<i32, i32>) {}
82-
LL + pub fn map<S: ::std::hash::BuildHasher>(map: &mut HashMap<i32, i32, S>) {}
83-
|
81+
LL | pub fn map<S: ::std::hash::BuildHasher>(map: &mut HashMap<i32, i32, S>) {}
82+
| +++++++++++++++++++++++++++++ +++
8483

8584
error: parameter of type `HashSet` should be generalized over different hashers
8685
--> tests/ui/implicit_hasher.rs:70:22
@@ -90,9 +89,8 @@ LL | pub fn set(set: &mut HashSet<i32>) {}
9089
|
9190
help: add a type parameter for `BuildHasher`
9291
|
93-
LL - pub fn set(set: &mut HashSet<i32>) {}
94-
LL + pub fn set<S: ::std::hash::BuildHasher>(set: &mut HashSet<i32, S>) {}
95-
|
92+
LL | pub fn set<S: ::std::hash::BuildHasher>(set: &mut HashSet<i32, S>) {}
93+
| +++++++++++++++++++++++++++++ +++
9694

9795
error: impl for `HashMap` should be generalized over different hashers
9896
--> tests/ui/implicit_hasher.rs:76:43
@@ -116,9 +114,8 @@ LL | pub async fn election_vote(_data: HashMap<i32, i32>) {}
116114
|
117115
help: add a type parameter for `BuildHasher`
118116
|
119-
LL - pub async fn election_vote(_data: HashMap<i32, i32>) {}
120-
LL + pub async fn election_vote<S: ::std::hash::BuildHasher>(_data: HashMap<i32, i32, S>) {}
121-
|
117+
LL | pub async fn election_vote<S: ::std::hash::BuildHasher>(_data: HashMap<i32, i32, S>) {}
118+
| +++++++++++++++++++++++++++++ +++
122119

123120
error: aborting due to 9 previous errors
124121

tests/ui/literals.stderr

+2-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ LL + let fail8 = 123;
9999
|
100100
help: if you mean to use an octal constant, use `0o`
101101
|
102-
LL - let fail8 = 0123;
103-
LL + let fail8 = 0o123;
104-
|
102+
LL | let fail8 = 0o123;
103+
| +
105104

106105
error: integer type suffix should not be separated by an underscore
107106
--> tests/ui/literals.rs:48:16

0 commit comments

Comments
 (0)