Skip to content

Commit

Permalink
address comment with using the binary search
Browse files Browse the repository at this point in the history
  • Loading branch information
tommady committed Feb 24, 2023
1 parent 92f8eba commit ba9c762
Showing 1 changed file with 36 additions and 8 deletions.
44 changes: 36 additions & 8 deletions src/info/filetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,42 @@ impl FileExtensions {
fn is_immediate(&self, file: &File<'_>) -> bool {
file.name.to_lowercase().starts_with("readme") ||
file.name.ends_with(".ninja") ||
file.name_is_one_of( &[
"GNUmakefile", "Makefile", "makefile", "Cargo.toml", "SConstruct", "CMakeLists.txt",
"build.gradle", "pom.xml", "Rakefile", "package.json", "Gruntfile.js",
"Gruntfile.coffee", "BUILD", "BUILD.bazel", "WORKSPACE", "build.xml", "Podfile",
"webpack.config.js", "meson.build", "composer.json", "RoboFile.php", "PKGBUILD",
"Justfile", "Procfile", "Dockerfile", "Containerfile", "Vagrantfile", "Brewfile",
"Gemfile", "Pipfile", "build.sbt", "mix.exs", "bsconfig.json", "tsconfig.json",
])
[
"BUILD",
"BUILD.bazel",
"Brewfile",
"CMakeLists.txt",
"Cargo.toml",
"Containerfile",
"Dockerfile",
"GNUmakefile",
"Gemfile",
"Gruntfile.coffee",
"Gruntfile.js",
"Justfile",
"Makefile",
"PKGBUILD",
"Pipfile",
"Podfile",
"Procfile",
"Rakefile",
"RoboFile.php",
"SConstruct",
"Vagrantfile",
"WORKSPACE",
"bsconfig.json",
"build.gradle",
"build.sbt",
"build.xml",
"composer.json",
"makefile",
"meson.build",
"mix.exs",
"package.json",
"pom.xml",
"tsconfig.json",
"webpack.config.js",
].binary_search(&file.name.as_str()).is_ok()
}

fn is_image(&self, file: &File<'_>) -> bool {
Expand Down

0 comments on commit ba9c762

Please sign in to comment.