mirror of
https://github.com/rust-lang/rust.git
synced 2026-02-15 01:14:05 +00:00
17 lines
406 B
Rust
17 lines
406 B
Rust
#![warn(clippy::manual_strip)]
|
|
#![allow(clippy::uninlined_format_args)]
|
|
|
|
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);
|
|
}
|
|
}
|