From cb933a6f62091cf036ae400ff83d0a8b1f578516 Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Tue, 10 Sep 2019 09:51:08 -0500 Subject: [PATCH] Remove unused code in File#get_source_files as the "class", "elc", "hi", "o", "pyc" extensions are first tested in FileExtensions#is_compiled, so removed code is redundant and neved called. --- src/info/sources.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/info/sources.rs b/src/info/sources.rs index c26ccef..5737995 100644 --- a/src/info/sources.rs +++ b/src/info/sources.rs @@ -8,21 +8,16 @@ impl<'a> File<'a> { /// For this file, return a vector of alternate file paths that, if any of /// them exist, mean that *this* file should be coloured as “compiled”. /// - /// The point of this is to highlight compiled files such as `foo.o` when - /// their source file `foo.c` exists in the same directory. It's too - /// dangerous to highlight *all* compiled, so the paths in this vector - /// are checked for existence first: for example, `foo.js` is perfectly - /// valid without `foo.coffee`. + /// The point of this is to highlight compiled files such as `foo.js` when + /// their source file `foo.coffee` exists in the same directory. + /// For example, `foo.js` is perfectly valid without `foo.coffee`, so we + /// don't want to always blindly highlight `*.js` as compiled. + /// (See also `FileExtensions#is_compiled`) pub fn get_source_files(&self) -> Vec { if let Some(ref ext) = self.ext { match &ext[..] { - "class" => vec![self.path.with_extension("java")], // Java "css" => vec![self.path.with_extension("sass"), self.path.with_extension("less")], // SASS, Less - "elc" => vec![self.path.with_extension("el")], // Emacs Lisp - "hi" => vec![self.path.with_extension("hs")], // Haskell "js" => vec![self.path.with_extension("coffee"), self.path.with_extension("ts")], // CoffeeScript, TypeScript - "o" => vec![self.path.with_extension("c"), self.path.with_extension("cpp")], // C, C++ - "pyc" => vec![self.path.with_extension("py")], // Python "aux" | // TeX: auxiliary file "bbl" | // BibTeX bibliography file