Explorar el Código

Simplify compiled file checking code

Ben S hace 11 años
padre
commit
f12da1ea4c
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      src/filetype.rs

+ 4 - 2
src/filetype.rs

@@ -126,8 +126,10 @@ impl<'a> HasType for File<'a> {
             if source_files.is_empty() {
                 return Normal;
             }
-            else if source_files.iter().any(|path| self.dir.map(|d| d.contains(path)).unwrap_or(false)) {
-                return Temp;
+            else if let Some(dir) = self.dir {
+                if source_files.iter().any(|path| dir.contains(path)) {
+                    return Temp;
+                }
             }
             else if COMPILED_TYPES.contains(&&ext[..]) {
                 return Compiled;