| 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 |
| |