2 #![warn(clippy::case_sensitive_file_extension_comparisons)]
4 use std::string::String;
9 fn ends_with(self, _arg: &str) {}
13 fn is_rust_file(filename: &str) -> bool {
14 filename.ends_with(".rs")
18 // std::string::String and &str should trigger the lint failure with .ext12
19 let _ = String::new().ends_with(".ext12");
20 let _ = "str".ends_with(".ext12");
22 // The fixup should preserve the indentation level
24 let _ = "str".ends_with(".ext12");
27 // The test struct should not trigger the lint failure with .ext12
28 TestStruct {}.ends_with(".ext12");
30 // std::string::String and &str should trigger the lint failure with .EXT12
31 let _ = String::new().ends_with(".EXT12");
32 let _ = "str".ends_with(".EXT12");
34 // Should not trigger the lint failure because of the calls to to_lowercase and to_uppercase
35 let _ = String::new().to_lowercase().ends_with(".EXT12");
36 let _ = String::new().to_uppercase().ends_with(".EXT12");
38 // The test struct should not trigger the lint failure with .EXT12
39 TestStruct {}.ends_with(".EXT12");
41 // Should not trigger the lint failure with .eXT12
42 let _ = String::new().ends_with(".eXT12");
43 let _ = "str".ends_with(".eXT12");
44 TestStruct {}.ends_with(".eXT12");
46 // Should not trigger the lint failure with .EXT123 (too long)
47 let _ = String::new().ends_with(".EXT123");
48 let _ = "str".ends_with(".EXT123");
49 TestStruct {}.ends_with(".EXT123");
51 // Shouldn't fail if it doesn't start with a dot
52 let _ = String::new().ends_with("a.ext");
53 let _ = "str".ends_with("a.extA");
54 TestStruct {}.ends_with("a.ext");