diff --git a/typos/src/checks.rs b/typos/src/checks.rs index a834ae9..8bd809c 100644 --- a/typos/src/checks.rs +++ b/typos/src/checks.rs @@ -238,7 +238,7 @@ impl Checks { 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 { + let msg = report::PathCorrection { path, typo: ident.token(), correction, @@ -249,7 +249,7 @@ impl Checks { } else { for word in ident.split() { if let Some(correction) = dictionary.correct_word(word) { - let msg = report::FilenameCorrection { + let msg = report::PathCorrection { path, typo: word.token(), correction, diff --git a/typos/src/report.rs b/typos/src/report.rs index 630b0e1..a472397 100644 --- a/typos/src/report.rs +++ b/typos/src/report.rs @@ -7,7 +7,7 @@ use std::io::{self, Write}; pub enum Message<'m> { BinaryFile(BinaryFile<'m>), Correction(Correction<'m>), - FilenameCorrection(FilenameCorrection<'m>), + PathCorrection(PathCorrection<'m>), File(File<'m>), Parse(Parse<'m>), PathError(PathError<'m>), @@ -38,7 +38,7 @@ pub struct Correction<'m> { } #[derive(Clone, Debug, serde::Serialize)] -pub struct FilenameCorrection<'m> { +pub struct PathCorrection<'m> { pub path: &'m std::path::Path, pub typo: &'m str, pub correction: Cow<'m, str>, @@ -133,7 +133,7 @@ impl Report for PrintBrief { msg.correction ); } - Message::FilenameCorrection(msg) => { + Message::PathCorrection(msg) => { println!("{}: {} -> {}", msg.path.display(), msg.typo, msg.correction); } Message::File(msg) => { @@ -165,7 +165,7 @@ impl Report for PrintLong { println!("{}", msg); } Message::Correction(msg) => print_long_correction(msg), - Message::FilenameCorrection(msg) => { + Message::PathCorrection(msg) => { println!( "{}: error: `{}` should be `{}`", msg.path.display(),