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 {