|
1 |
| -error[E0425]: cannot find value `x` in this scope |
2 |
| - --> $DIR/min_rust_version_attr.rs:77:5 |
| 1 | +error: stripping a prefix manually |
| 2 | + --> $DIR/min_rust_version_attr.rs:142:24 |
3 | 3 | |
|
4 |
| -LL | x >= 8 && x < 12; |
5 |
| - | ^ not found in this scope |
6 |
| - |
7 |
| -error[E0425]: cannot find value `x` in this scope |
8 |
| - --> $DIR/min_rust_version_attr.rs:77:15 |
| 4 | +LL | assert_eq!(s["hello, ".len()..].to_uppercase(), "WORLD!"); |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^ |
| 6 | + | |
| 7 | + = note: `-D clippy::manual-strip` implied by `-D warnings` |
| 8 | +note: the prefix was tested here |
| 9 | + --> $DIR/min_rust_version_attr.rs:141:9 |
| 10 | + | |
| 11 | +LL | if s.starts_with("hello, ") { |
| 12 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 13 | +help: try using the `strip_prefix` method |
| 14 | + | |
| 15 | +LL | if let Some(<stripped>) = s.strip_prefix("hello, ") { |
| 16 | +LL | assert_eq!(<stripped>.to_uppercase(), "WORLD!"); |
9 | 17 | |
|
10 |
| -LL | x >= 8 && x < 12; |
11 |
| - | ^ not found in this scope |
12 | 18 |
|
13 |
| -error[E0308]: mismatched types |
14 |
| - --> $DIR/min_rust_version_attr.rs:95:31 |
| 19 | +error: stripping a prefix manually |
| 20 | + --> $DIR/min_rust_version_attr.rs:154:24 |
| 21 | + | |
| 22 | +LL | assert_eq!(s["hello, ".len()..].to_uppercase(), "WORLD!"); |
| 23 | + | ^^^^^^^^^^^^^^^^^^^^ |
| 24 | + | |
| 25 | +note: the prefix was tested here |
| 26 | + --> $DIR/min_rust_version_attr.rs:153:9 |
| 27 | + | |
| 28 | +LL | if s.starts_with("hello, ") { |
| 29 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 30 | +help: try using the `strip_prefix` method |
15 | 31 | |
|
16 |
| -LL | let _ = std::mem::replace(s, String::default()); |
17 |
| - | ^ |
18 |
| - | | |
19 |
| - | expected `&mut _`, found struct `std::string::String` |
20 |
| - | help: consider mutably borrowing here: `&mut s` |
| 32 | +LL | if let Some(<stripped>) = s.strip_prefix("hello, ") { |
| 33 | +LL | assert_eq!(<stripped>.to_uppercase(), "WORLD!"); |
21 | 34 | |
|
22 |
| - = note: expected mutable reference `&mut _` |
23 |
| - found struct `std::string::String` |
24 | 35 |
|
25 |
| -error: aborting due to 3 previous errors |
| 36 | +error: aborting due to 2 previous errors |
26 | 37 |
|
27 |
| -Some errors have detailed explanations: E0308, E0425. |
28 |
| -For more information about an error, try `rustc --explain E0308`. |
|
0 commit comments