]> git.lizzy.rs Git - rust.git/blob - tests/ui/case_sensitive_file_extension_comparisons.stderr
Suggest using Path for comparing extensions
[rust.git] / tests / ui / case_sensitive_file_extension_comparisons.stderr
1 error: case-sensitive file extension comparison
2   --> $DIR/case_sensitive_file_extension_comparisons.rs:14:5
3    |
4 LL |     filename.ends_with(".rs")
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = help: consider using a case-insensitive comparison instead
8    = note: `-D clippy::case-sensitive-file-extension-comparisons` implied by `-D warnings`
9 help: use std::path::Path
10    |
11 LL ~     std::path::Path::new(filename)
12 LL +         .extension()
13 LL +         .map_or(false, |ext| ext.eq_ignore_ascii_case("rs"))
14    |
15
16 error: case-sensitive file extension comparison
17   --> $DIR/case_sensitive_file_extension_comparisons.rs:19:13
18    |
19 LL |     let _ = String::new().ends_with(".ext12");
20    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21    |
22    = help: consider using a case-insensitive comparison instead
23 help: use std::path::Path
24    |
25 LL ~     let _ = std::path::Path::new(&String::new())
26 LL +         .extension()
27 LL ~         .map_or(false, |ext| ext.eq_ignore_ascii_case("ext12"));
28    |
29
30 error: case-sensitive file extension comparison
31   --> $DIR/case_sensitive_file_extension_comparisons.rs:20:13
32    |
33 LL |     let _ = "str".ends_with(".ext12");
34    |             ^^^^^^^^^^^^^^^^^^^^^^^^^
35    |
36    = help: consider using a case-insensitive comparison instead
37 help: use std::path::Path
38    |
39 LL ~     let _ = std::path::Path::new("str")
40 LL +         .extension()
41 LL ~         .map_or(false, |ext| ext.eq_ignore_ascii_case("ext12"));
42    |
43
44 error: case-sensitive file extension comparison
45   --> $DIR/case_sensitive_file_extension_comparisons.rs:26:13
46    |
47 LL |     let _ = String::new().ends_with(".EXT12");
48    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
49    |
50    = help: consider using a case-insensitive comparison instead
51 help: use std::path::Path
52    |
53 LL ~     let _ = std::path::Path::new(&String::new())
54 LL +         .extension()
55 LL ~         .map_or(false, |ext| ext.eq_ignore_ascii_case("EXT12"));
56    |
57
58 error: case-sensitive file extension comparison
59   --> $DIR/case_sensitive_file_extension_comparisons.rs:27:13
60    |
61 LL |     let _ = "str".ends_with(".EXT12");
62    |             ^^^^^^^^^^^^^^^^^^^^^^^^^
63    |
64    = help: consider using a case-insensitive comparison instead
65 help: use std::path::Path
66    |
67 LL ~     let _ = std::path::Path::new("str")
68 LL +         .extension()
69 LL ~         .map_or(false, |ext| ext.eq_ignore_ascii_case("EXT12"));
70    |
71
72 error: case-sensitive file extension comparison
73   --> $DIR/case_sensitive_file_extension_comparisons.rs:30:13
74    |
75 LL |     let _ = String::new().to_lowercase().ends_with(".EXT12");
76    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
77    |
78    = help: consider using a case-insensitive comparison instead
79    = note: to_lowercase allocates memory, this can be avoided by using Path
80 help: use std::path::Path
81    |
82 LL ~     let _ = std::path::Path::new(&String::new())
83 LL +         .extension()
84 LL ~         .map_or(false, |ext| ext.eq_ignore_ascii_case("EXT12"));
85    |
86
87 error: case-sensitive file extension comparison
88   --> $DIR/case_sensitive_file_extension_comparisons.rs:31:13
89    |
90 LL |     let _ = String::new().to_uppercase().ends_with(".EXT12");
91    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92    |
93    = help: consider using a case-insensitive comparison instead
94    = note: to_uppercase allocates memory, this can be avoided by using Path
95 help: use std::path::Path
96    |
97 LL ~     let _ = std::path::Path::new(&String::new())
98 LL +         .extension()
99 LL ~         .map_or(false, |ext| ext.eq_ignore_ascii_case("EXT12"));
100    |
101
102 error: aborting due to 7 previous errors
103