Skip to content

Commit

Permalink
Simplify checking for ghost file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Ortham committed Jun 26, 2024
1 parent e17941b commit 1238712
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ impl PartialEq<&std::borrow::Cow<'_, str>> for FileExtension {
}

fn is_ghost_file_extension(extension: &str) -> bool {
const GHOST: &str = "ghost";

// Generally not a good idea to lowercase strings for case-insensitive
// comparison, but this is ASCII, and we're checking that the string is of
// the correct length first, so lowercasing won't be expensive.
extension.len() == GHOST.len() && extension.to_lowercase() == GHOST
extension.eq_ignore_ascii_case("ghost")
}

#[derive(Clone, Default, PartialEq, Eq, Debug, Hash)]
Expand Down

0 comments on commit 1238712

Please sign in to comment.