Files
rust/tests/ui/manual_strip_fixable.fixed

16 lines
365 B
Rust
Raw Normal View History

#![warn(clippy::manual_strip)]
fn main() {
let s = "abc";
if let Some(stripped) = s.strip_prefix("ab") {
//~^ ERROR: stripping a prefix manually
println!("{stripped}{}", stripped);
}
if let Some(stripped) = s.strip_suffix("bc") {
//~^ ERROR: stripping a suffix manually
println!("{stripped}{}", stripped);
}
}