2 use std::path::PathBuf;
5 if let Err(e) = doit() {
6 println!("error: {}", e);
11 fn doit() -> Result<(), Box<dyn Error>> {
12 let mut args = std::env::args().skip(1);
13 let mut src_path = None;
14 let mut out_path = None;
15 let mut rustc_path = None;
16 let mut verbose = false;
17 while let Some(arg) = args.next() {
20 src_path = match args.next() {
21 Some(s) => Some(PathBuf::from(s)),
22 None => return Err("--src requires a value".into()),
26 out_path = match args.next() {
27 Some(s) => Some(PathBuf::from(s)),
28 None => return Err("--out requires a value".into()),
32 rustc_path = match args.next() {
33 Some(s) => Some(PathBuf::from(s)),
34 None => return Err("--rustc requires a value".into()),
37 "-v" | "--verbose" => verbose = true,
38 s => return Err(format!("unexpected argument `{}`", s).into()),
41 if src_path.is_none() {
42 return Err("--src must be specified to the directory with the compiler source".into());
44 if out_path.is_none() {
45 return Err("--out must be specified to the directory with the lint listing docs".into());
47 if rustc_path.is_none() {
48 return Err("--rustc must be specified to the path of rustc".into());
50 lint_docs::extract_lint_docs(