Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions stable-check/src/main.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Expand All @@ -26,15 +26,15 @@ fn check_directory(dir: &Path) -> Result<(), Box<dyn Error>> {
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)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use fs::read_to_string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I noticed that, too. I rewrote it in #886.


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)));
}
}
}

Expand Down