mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
47 lines
917 B
Rust
47 lines
917 B
Rust
|
// run-rustfix
|
||
|
#![allow(dead_code, unused_must_use)]
|
||
|
|
||
|
fn main() {}
|
||
|
|
||
|
#[allow(clippy::unnecessary_operation)]
|
||
|
fn starts_with() {
|
||
|
"".starts_with(' ');
|
||
|
!"".starts_with(' ');
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|
||
|
if !s.ends_with('o') {
|
||
|
// !s.ends_with('o')
|
||
|
// Nothing here
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#[allow(clippy::unnecessary_operation)]
|
||
|
fn ends_with() {
|
||
|
"".ends_with(' ');
|
||
|
!"".ends_with(' ');
|
||
|
"".ends_with(' ');
|
||
|
!"".ends_with(' ');
|
||
|
}
|