Closed
Description
Summary
This could be user error but I would have thought that forcing the str to lowercase would mean that it's ok to test for an extension with ends_with.
Lint Name
No response
Reproducer
I tried this code:
pub fn is_jpg(filename: &str) -> bool {
filename.to_lowercase().ends_with(".jpg")
}
I saw this happen:
warning: case-sensitive file extension comparison
--> (filename)
|
(line) | filename.to_lowercase().ends_with(".jpg")
| ^^^^^^^^^^^^^^^^^
|
= note: `-W clippy::case-sensitive-file-extension-comparisons` implied by `-W clippy::pedantic`
= help: consider using a case-insensitive comparison instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#case_sensitive_file_extension_comparisons
I expected to see this happen:
(no output)
Version
rustc 1.62.1 (e092d0b6b 2022-07-16)
binary: rustc
commit-hash: e092d0b6b43f2de967af0887873151bb1c0b18d3
commit-date: 2022-07-16
host: x86_64-apple-darwin
release: 1.62.1
LLVM version: 14.0.5
Additional Labels
No response