blob: da8b0cd08f8936558ccf1e36040eeff085c7f06c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
error: stripping a prefix manually
--> tests/ui/manual_strip_fixable.rs:8:24
|
LL | let stripped = &s["ab".len()..];
| ^^^^^^^^^^^^^^^^
|
note: the prefix was tested here
--> tests/ui/manual_strip_fixable.rs:7:5
|
LL | if s.starts_with("ab") {
| ^^^^^^^^^^^^^^^^^^^^^^^
= note: `-D clippy::manual-strip` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::manual_strip)]`
help: try using the `strip_prefix` method
|
LL ~ if let Some(stripped) = s.strip_prefix("ab") {
LL ~
LL ~ println!("{stripped}{}", stripped);
|
error: stripping a suffix manually
--> tests/ui/manual_strip_fixable.rs:14:24
|
LL | let stripped = &s[..s.len() - "bc".len()];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the suffix was tested here
--> tests/ui/manual_strip_fixable.rs:13:5
|
LL | if s.ends_with("bc") {
| ^^^^^^^^^^^^^^^^^^^^^
help: try using the `strip_suffix` method
|
LL ~ if let Some(stripped) = s.strip_suffix("bc") {
LL ~
LL ~ println!("{stripped}{}", stripped);
|
error: aborting due to 2 previous errors
|