]> git.lizzy.rs Git - rust.git/blob - tests/ui/starts_ends_with.fixed
Auto merge of #3657 - roblabla:bugfix-missing-docs-global-asm, r=phansch
[rust.git] / tests / ui / starts_ends_with.fixed
1 // run-rustfix
2 #![allow(dead_code, unused_must_use)]
3
4 fn main() {}
5
6 #[allow(clippy::unnecessary_operation)]
7 fn starts_with() {
8     "".starts_with(' ');
9     !"".starts_with(' ');
10 }
11
12 fn chars_cmp_with_unwrap() {
13     let s = String::from("foo");
14     if s.starts_with('f') {
15         // s.starts_with('f')
16         // Nothing here
17     }
18     if s.ends_with('o') {
19         // s.ends_with('o')
20         // Nothing here
21     }
22     if s.ends_with('o') {
23         // s.ends_with('o')
24         // Nothing here
25     }
26     if !s.starts_with('f') {
27         // !s.starts_with('f')
28         // Nothing here
29     }
30     if !s.ends_with('o') {
31         // !s.ends_with('o')
32         // Nothing here
33     }
34     if !s.ends_with('o') {
35         // !s.ends_with('o')
36         // Nothing here
37     }
38 }
39
40 #[allow(clippy::unnecessary_operation)]
41 fn ends_with() {
42     "".ends_with(' ');
43     !"".ends_with(' ');
44     "".ends_with(' ');
45     !"".ends_with(' ');
46 }