From 54aaffed494c91c13ae7fb195757d76c1bb8578f Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 30 Mar 2020 10:24:15 -0500 Subject: [PATCH] fix: Only check filename, not parent dirs --- typos/src/checks.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typos/src/checks.rs b/typos/src/checks.rs index 2e6a611..a834ae9 100644 --- a/typos/src/checks.rs +++ b/typos/src/checks.rs @@ -235,7 +235,7 @@ impl Checks { return Ok(typos_found); } - for part in path.components().filter_map(|c| c.as_os_str().to_str()) { + if let Some(part) = path.file_name().and_then(|s| s.to_str()) { for ident in parser.parse(part) { if let Some(correction) = dictionary.correct_ident(ident) { let msg = report::FilenameCorrection {