fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1#![allow(clippy::needless_if, dead_code, unused_must_use)] 2 3fn main() {} 4 5#[allow(clippy::unnecessary_operation)] 6fn starts_with() { 7 "".starts_with(' '); 8 !"".starts_with(' '); 9 10 // Ensure that suggestion is escaped correctly 11 "".starts_with('\n'); 12 !"".starts_with('\n'); 13} 14 15fn chars_cmp_with_unwrap() { 16 let s = String::from("foo"); 17 if s.starts_with('f') { 18 // s.starts_with('f') 19 // Nothing here 20 } 21 if s.ends_with('o') { 22 // s.ends_with('o') 23 // Nothing here 24 } 25 if s.ends_with('o') { 26 // s.ends_with('o') 27 // Nothing here 28 } 29 if !s.starts_with('f') { 30 // !s.starts_with('f') 31 // Nothing here 32 } 33 if !s.ends_with('o') { 34 // !s.ends_with('o') 35 // Nothing here 36 } 37 if !s.ends_with('\n') { 38 // !s.ends_with('o') 39 // Nothing here 40 } 41} 42 43#[allow(clippy::unnecessary_operation)] 44fn ends_with() { 45 "".ends_with(' '); 46 !"".ends_with(' '); 47 "".ends_with(' '); 48 !"".ends_with(' '); 49 50 // Ensure that suggestion is escaped correctly 51 "".ends_with('\n'); 52 !"".ends_with('\n'); 53}