Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4d26177

Browse files
authoredJul 4, 2024
Rollup merge of rust-lang#127301 - estebank:fix-suggestions, r=Urgau
Tweak some structured suggestions to be more verbose and accurate Addressing some issues I found while working on rust-lang#127282. ``` error: this URL is not a hyperlink --> $DIR/auxiliary/include-str-bare-urls.md:1:11 | LL | HEADS UP! https://example.com MUST SHOW UP IN THE STDERR FILE! | ^^^^^^^^^^^^^^^^^^^ | = note: bare URLs are not automatically turned into clickable links note: the lint level is defined here --> $DIR/include-str-bare-urls.rs:14:9 | LL | #![deny(rustdoc::bare_urls)] | ^^^^^^^^^^^^^^^^^^ help: use an automatic link instead | LL | HEADS UP! <https://example.com> MUST SHOW UP IN THE STDERR FILE! | + + ``` ``` error[E0384]: cannot assign twice to immutable variable `v` --> $DIR/assign-imm-local-twice.rs:7:5 | LL | v = 1; | ----- first assignment to `v` LL | println!("v={}", v); LL | v = 2; | ^^^^^ cannot assign twice to immutable variable | help: consider making this binding mutable | LL | let mut v: isize; | +++ ``` ``` error[E0393]: the type parameter `Rhs` must be explicitly specified --> $DIR/issue-22560.rs:9:23 | LL | trait Sub<Rhs=Self> { | ------------------- type parameter `Rhs` must be specified for this ... LL | type Test = dyn Add + Sub; | ^^^ | = note: because of the default `Self` reference, type parameters must be specified on object types help: set the type parameter to the desired type | LL | type Test = dyn Add + Sub<Rhs>; | +++++ ``` ``` error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable --> $DIR/issue-33819.rs:4:34 | LL | Some(ref v) => { let a = &mut v; }, | ^^^^^^ cannot borrow as mutable | help: try removing `&mut` here | LL - Some(ref v) => { let a = &mut v; }, LL + Some(ref v) => { let a = v; }, | ``` ``` help: remove the invocation before committing it to a version control system | LL - dbg!(); | ``` ``` error[E0308]: mismatched types --> $DIR/issue-39974.rs:1:21 | LL | const LENGTH: f64 = 2; | ^ expected `f64`, found integer | help: use a float literal | LL | const LENGTH: f64 = 2.0; | ++ ``` ``` error[E0529]: expected an array or slice, found `Vec<i32>` --> $DIR/match-ergonomics.rs:8:9 | LL | [&v] => {}, | ^^^^ pattern cannot match with input type `Vec<i32>` | help: consider slicing here | LL | match x[..] { | ++++ ``` ``` error[E0609]: no field `0` on type `[u32; 1]` --> $DIR/parenthesized-deref-suggestion.rs:10:21 | LL | (x as [u32; 1]).0; | ^ unknown field | help: instead of using tuple indexing, use array indexing | LL | (x as [u32; 1])[0]; | ~ + ```
2 parents 2440075 + 9b7227c commit 4d26177

4 files changed

+0
-15
lines changed
 

‎tests/ui/dbg_macro/dbg_macro.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ LL | dbg!();
8686
help: remove the invocation before committing it to a version control system
8787
|
8888
LL - dbg!();
89-
LL +
9089
|
9190

9291
error: the `dbg!` macro is intended as a debugging tool
@@ -146,7 +145,6 @@ LL | expand_to_dbg!();
146145
help: remove the invocation before committing it to a version control system
147146
|
148147
LL - dbg!();
149-
LL +
150148
|
151149

152150
error: the `dbg!` macro is intended as a debugging tool

‎tests/ui/dbg_macro/dbg_macro_unfixable.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ LL | dbg!();
99
help: remove the invocation before committing it to a version control system
1010
|
1111
LL - dbg!();
12-
LL +
1312
|
1413

1514
error: the `dbg!` macro is intended as a debugging tool

‎tests/ui/manual_split_once.stderr

-10
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,10 @@ LL | let (l, r) = "a.b.c".split_once('.').unwrap();
9696
help: remove the `iter` usages
9797
|
9898
LL - let l = iter.next().unwrap();
99-
LL +
10099
|
101100
help: remove the `iter` usages
102101
|
103102
LL - let r = iter.next().unwrap();
104-
LL +
105103
|
106104

107105
error: manual implementation of `split_once`
@@ -121,12 +119,10 @@ LL | let (l, r) = "a.b.c".split_once('.')?;
121119
help: remove the `iter` usages
122120
|
123121
LL - let l = iter.next()?;
124-
LL +
125122
|
126123
help: remove the `iter` usages
127124
|
128125
LL - let r = iter.next()?;
129-
LL +
130126
|
131127

132128
error: manual implementation of `rsplit_once`
@@ -146,12 +142,10 @@ LL | let (l, r) = "a.b.c".rsplit_once('.').unwrap();
146142
help: remove the `iter` usages
147143
|
148144
LL - let r = iter.next().unwrap();
149-
LL +
150145
|
151146
help: remove the `iter` usages
152147
|
153148
LL - let l = iter.next().unwrap();
154-
LL +
155149
|
156150

157151
error: manual implementation of `rsplit_once`
@@ -171,12 +165,10 @@ LL | let (l, r) = "a.b.c".rsplit_once('.')?;
171165
help: remove the `iter` usages
172166
|
173167
LL - let r = iter.next()?;
174-
LL +
175168
|
176169
help: remove the `iter` usages
177170
|
178171
LL - let l = iter.next()?;
179-
LL +
180172
|
181173

182174
error: manual implementation of `split_once`
@@ -202,12 +194,10 @@ LL | let (a, b) = "a.b.c".split_once('.').unwrap();
202194
help: remove the `iter` usages
203195
|
204196
LL - let a = iter.next().unwrap();
205-
LL +
206197
|
207198
help: remove the `iter` usages
208199
|
209200
LL - let b = iter.next().unwrap();
210-
LL +
211201
|
212202

213203
error: aborting due to 19 previous errors

‎tests/ui/significant_drop_tightening.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ LL + let rslt0 = mutex.lock().unwrap().abs();
6464
help: remove separated single usage
6565
|
6666
LL - let rslt0 = lock.abs();
67-
LL +
6867
|
6968

7069
error: temporary with significant `Drop` can be early dropped
@@ -88,7 +87,6 @@ LL + mutex.lock().unwrap().clear();
8887
help: remove separated single usage
8988
|
9089
LL - lock.clear();
91-
LL +
9290
|
9391

9492
error: aborting due to 4 previous errors

0 commit comments

Comments
 (0)
Failed to load comments.