From dc6fcaeae8b938f15ffc7dfeafc583d69ccd2be7 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Fri, 19 Aug 2022 07:19:14 +0200 Subject: [PATCH] address review comment https://github.com/rust-lang/rustc-dev-guide/pull/1428#discussion_r948143840 --- ci/date-check/src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/date-check/src/main.rs b/ci/date-check/src/main.rs index ea8b2431..70fce8b1 100644 --- a/ci/date-check/src/main.rs +++ b/ci/date-check/src/main.rs @@ -3,6 +3,7 @@ use std::{ convert::TryInto as _, env, fmt, fs, path::{Path, PathBuf}, + process, str::FromStr, }; @@ -124,7 +125,12 @@ fn filter_dates( } fn main() { - let root_dir = env::args().nth(1).unwrap_or(".".into()); + let mut args = env::args(); + if args.len() == 1 { + eprintln!("error: expected root Markdown directory as CLI argument"); + process::exit(1); + } + let root_dir = args.nth(1).unwrap(); let root_dir_path = Path::new(&root_dir); let glob_pat = format!("{}/**/*.md", root_dir); let today_chrono = Utc::today();