]>
git.proxmox.com Git - rustc.git/blob - src/doc/reference/stable-check/src/main.rs
5 use std
::io
::prelude
::*;
9 let arg
= env
::args().nth(1).unwrap_or_else(|| {
10 println
!("Please pass a src directory as the first argument");
11 std
::process
::exit(1);
14 match check_directory(&Path
::new(&arg
)) {
15 Ok(()) => println
!("passed!"),
17 println
!("Error: {}", e
);
18 std
::process
::exit(1);
23 fn check_directory(dir
: &Path
) -> Result
<(), Box
<dyn Error
>> {
24 for entry
in fs
::read_dir(dir
)?
{
26 let path
= entry
.path();
29 return check_directory(&path
);
32 let mut file
= File
::open(&path
)?
;
33 let mut contents
= String
::new();
34 file
.read_to_string(&mut contents
)?
;
36 if contents
.contains("#![feature") {
37 return Err(From
::from(format
!("Feature flag found in {:?}", path
)));