]> git.proxmox.com Git - rustc.git/blame - src/tools/tidy/src/main.rs
New upstream version 1.20.0+dfsg1
[rustc.git] / src / tools / tidy / src / main.rs
CommitLineData
a7813a04
XL
1// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
041b39d2 11//! Tidy checks source code in this repository
a7813a04
XL
12//!
13//! This program runs all of the various tidy checks for style, cleanliness,
14//! etc. This is run by default on `make check` and as part of the auto
15//! builders.
16
041b39d2 17#![deny(warnings)]
a7813a04 18
041b39d2
XL
19extern crate tidy;
20use tidy::*;
a7813a04 21
041b39d2
XL
22use std::process;
23use std::path::PathBuf;
24use std::env;
25use std::io::{self, Write};
a7813a04
XL
26
27fn main() {
28 let path = env::args_os().skip(1).next().expect("need an argument");
29 let path = PathBuf::from(path);
30
8bb4bdeb
XL
31 let args: Vec<String> = env::args().skip(1).collect();
32
a7813a04 33 let mut bad = false;
7cac9316 34 let quiet = args.iter().any(|s| *s == "--quiet");
a7813a04
XL
35 bins::check(&path, &mut bad);
36 style::check(&path, &mut bad);
37 errors::check(&path, &mut bad);
38 cargo::check(&path, &mut bad);
7cac9316 39 features::check(&path, &mut bad, quiet);
c30ab7b3 40 pal::check(&path, &mut bad);
cc61c64b 41 unstable_book::check(&path, &mut bad);
8bb4bdeb
XL
42 if !args.iter().any(|s| *s == "--no-vendor") {
43 deps::check(&path, &mut bad);
44 }
a7813a04
XL
45
46 if bad {
cc61c64b
XL
47 writeln!(io::stderr(), "some tidy checks failed").expect("could not write to stderr");
48 process::exit(1);
a7813a04
XL
49 }
50}