diff options
| author | Tshepang Mbambo <tshepang@gmail.com> | 2022-08-14 16:30:07 +0200 |
|---|---|---|
| committer | Noah Lev <camelidcamel@gmail.com> | 2022-08-25 19:56:58 -0700 |
| commit | ba6d4a9a1cf2d2e94602aa08ce37df3401e02a05 (patch) | |
| tree | 0c44881f2cbe091353ca8a68cb73d978c1db53cd /src/doc | |
| parent | bad0cec3f689b7916ceeec33639727d14ebdecd7 (diff) | |
make date-check more easy to use
One could not run it like the following, for the would be a panic:
cargo run --manifest-path ci/date-check/Cargo.toml .
Also, remove the need to specify argument, in which case, current_dir
is assumed.
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/rustc-dev-guide/ci/date-check/src/main.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/doc/rustc-dev-guide/ci/date-check/src/main.rs b/src/doc/rustc-dev-guide/ci/date-check/src/main.rs index bb3542f2410..ea8b24315e5 100644 --- a/src/doc/rustc-dev-guide/ci/date-check/src/main.rs +++ b/src/doc/rustc-dev-guide/ci/date-check/src/main.rs @@ -124,9 +124,7 @@ fn filter_dates( } fn main() { - let root_dir = env::args() - .nth(1) - .expect("expect root Markdown directory as CLI argument"); + let root_dir = env::args().nth(1).unwrap_or(".".into()); let root_dir_path = Path::new(&root_dir); let glob_pat = format!("{}/**/*.md", root_dir); let today_chrono = Utc::today(); @@ -167,7 +165,7 @@ fn main() { for (path, dates) in dates_by_file { println!( "- [ ] {}", - path.strip_prefix(&root_dir_path).unwrap().display() + path.strip_prefix(&root_dir_path).unwrap_or(&path).display(), ); for (line, date) in dates { println!(" - [ ] line {}: {}", line, date); |
