2023-04-23 06:03:09 -05:00
|
|
|
//@run-rustfix
|
2023-07-02 07:35:19 -05:00
|
|
|
#![allow(clippy::needless_if, dead_code, unused_must_use)]
|
2019-01-13 12:40:14 -06:00
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
|
|
|
|
#[allow(clippy::unnecessary_operation)]
|
|
|
|
fn starts_with() {
|
|
|
|
"".starts_with(' ');
|
|
|
|
!"".starts_with(' ');
|
2022-02-10 11:40:06 -06:00
|
|
|
|
|
|
|
// Ensure that suggestion is escaped correctly
|
|
|
|
"".starts_with('\n');
|
|
|
|
!"".starts_with('\n');
|
2019-01-13 12:40:14 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn chars_cmp_with_unwrap() {
|
|
|
|
let s = String::from("foo");
|
|
|
|
if s.starts_with('f') {
|
|
|
|
// s.starts_with('f')
|
|
|
|
// Nothing here
|
|
|
|
}
|
|
|
|
if s.ends_with('o') {
|
|
|
|
// s.ends_with('o')
|
|
|
|
// Nothing here
|
|
|
|
}
|
|
|
|
if s.ends_with('o') {
|
|
|
|
// s.ends_with('o')
|
|
|
|
// Nothing here
|
|
|
|
}
|
|
|
|
if !s.starts_with('f') {
|
|
|
|
// !s.starts_with('f')
|
|
|
|
// Nothing here
|
|
|
|
}
|
|
|
|
if !s.ends_with('o') {
|
|
|
|
// !s.ends_with('o')
|
|
|
|
// Nothing here
|
|
|
|
}
|
2022-02-10 11:40:06 -06:00
|
|
|
if !s.ends_with('\n') {
|
2019-01-13 12:40:14 -06:00
|
|
|
// !s.ends_with('o')
|
|
|
|
// Nothing here
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[allow(clippy::unnecessary_operation)]
|
|
|
|
fn ends_with() {
|
|
|
|
"".ends_with(' ');
|
|
|
|
!"".ends_with(' ');
|
|
|
|
"".ends_with(' ');
|
|
|
|
!"".ends_with(' ');
|
2022-02-10 11:40:06 -06:00
|
|
|
|
|
|
|
// Ensure that suggestion is escaped correctly
|
|
|
|
"".ends_with('\n');
|
|
|
|
!"".ends_with('\n');
|
2019-01-13 12:40:14 -06:00
|
|
|
}
|