Rollup merge of #127301 - estebank:fix-suggestions, r=Urgau

Tweak some structured suggestions to be more verbose and accurate

Addressing some issues I found while working on #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];
   |                    ~ +
```
This commit is contained in:
Matthias Krüger 2024-07-04 18:16:24 +02:00 committed by GitHub
commit 4d261774b7
4 changed files with 0 additions and 15 deletions

View File

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

View File

@ -9,7 +9,6 @@ LL | dbg!();
help: remove the invocation before committing it to a version control system
|
LL - dbg!();
LL +
|
error: the `dbg!` macro is intended as a debugging tool

View File

@ -96,12 +96,10 @@ LL | let (l, r) = "a.b.c".split_once('.').unwrap();
help: remove the `iter` usages
|
LL - let l = iter.next().unwrap();
LL +
|
help: remove the `iter` usages
|
LL - let r = iter.next().unwrap();
LL +
|
error: manual implementation of `split_once`
@ -121,12 +119,10 @@ LL | let (l, r) = "a.b.c".split_once('.')?;
help: remove the `iter` usages
|
LL - let l = iter.next()?;
LL +
|
help: remove the `iter` usages
|
LL - let r = iter.next()?;
LL +
|
error: manual implementation of `rsplit_once`
@ -146,12 +142,10 @@ LL | let (l, r) = "a.b.c".rsplit_once('.').unwrap();
help: remove the `iter` usages
|
LL - let r = iter.next().unwrap();
LL +
|
help: remove the `iter` usages
|
LL - let l = iter.next().unwrap();
LL +
|
error: manual implementation of `rsplit_once`
@ -171,12 +165,10 @@ LL | let (l, r) = "a.b.c".rsplit_once('.')?;
help: remove the `iter` usages
|
LL - let r = iter.next()?;
LL +
|
help: remove the `iter` usages
|
LL - let l = iter.next()?;
LL +
|
error: manual implementation of `split_once`
@ -202,12 +194,10 @@ LL | let (a, b) = "a.b.c".split_once('.').unwrap();
help: remove the `iter` usages
|
LL - let a = iter.next().unwrap();
LL +
|
help: remove the `iter` usages
|
LL - let b = iter.next().unwrap();
LL +
|
error: aborting due to 19 previous errors

View File

@ -64,7 +64,6 @@ LL + let rslt0 = mutex.lock().unwrap().abs();
help: remove separated single usage
|
LL - let rslt0 = lock.abs();
LL +
|
error: temporary with significant `Drop` can be early dropped
@ -88,7 +87,6 @@ LL + mutex.lock().unwrap().clear();
help: remove separated single usage
|
LL - lock.clear();
LL +
|
error: aborting due to 4 previous errors