1 #![warn(clippy::case_sensitive_file_extension_comparisons)]
3 use std::string::String;
8 fn ends_with(self, arg: &str) {}
11 fn is_rust_file(filename: &str) -> bool {
12 filename.ends_with(".rs")
16 // std::string::String and &str should trigger the lint failure with .ext12
17 let _ = String::from("").ends_with(".ext12");
18 let _ = "str".ends_with(".ext12");
20 // The test struct should not trigger the lint failure with .ext12
21 TestStruct {}.ends_with(".ext12");
23 // std::string::String and &str should trigger the lint failure with .EXT12
24 let _ = String::from("").ends_with(".EXT12");
25 let _ = "str".ends_with(".EXT12");
27 // The test struct should not trigger the lint failure with .EXT12
28 TestStruct {}.ends_with(".EXT12");
30 // Should not trigger the lint failure with .eXT12
31 let _ = String::from("").ends_with(".eXT12");
32 let _ = "str".ends_with(".eXT12");
33 TestStruct {}.ends_with(".eXT12");
35 // Should not trigger the lint failure with .EXT123 (too long)
36 let _ = String::from("").ends_with(".EXT123");
37 let _ = "str".ends_with(".EXT123");
38 TestStruct {}.ends_with(".EXT123");
40 // Shouldn't fail if it doesn't start with a dot
41 let _ = String::from("").ends_with("a.ext");
42 let _ = "str".ends_with("a.extA");
43 TestStruct {}.ends_with("a.ext");