]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/starts_ends_with.fixed
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / tests / ui / starts_ends_with.fixed
CommitLineData
f20569fa
XL
1// run-rustfix
2#![allow(dead_code, unused_must_use)]
3
4fn main() {}
5
6#[allow(clippy::unnecessary_operation)]
7fn starts_with() {
8 "".starts_with(' ');
9 !"".starts_with(' ');
10}
11
12fn 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)]
41fn ends_with() {
42 "".ends_with(' ');
43 !"".ends_with(' ');
44 "".ends_with(' ');
45 !"".ends_with(' ');
46}