diff --git a/stable-check/src/main.rs b/stable-check/src/main.rs index fc56ff7bb..1098e380c 100644 --- a/stable-check/src/main.rs +++ b/stable-check/src/main.rs @@ -1,5 +1,5 @@ -use std::error::Error; use std::env; +use std::error::Error; use std::fs; use std::fs::File; use std::io::prelude::*; @@ -26,15 +26,15 @@ fn check_directory(dir: &Path) -> Result<(), Box> { let path = entry.path(); if path.is_dir() { - return check_directory(&path); - } - - let mut file = File::open(&path)?; - let mut contents = String::new(); - file.read_to_string(&mut contents)?; + check_directory(&path)?; + } else { + let mut file = File::open(&path)?; + let mut contents = String::new(); + file.read_to_string(&mut contents)?; - if contents.contains("#![feature") { - return Err(From::from(format!("Feature flag found in {:?}", path))); + if contents.contains("#![feature") { + return Err(From::from(format!("Feature flag found in {:?}", path))); + } } }