mirror of
https://github.com/crate-ci/typos.git
synced 2026-11-14 10:03:53 +01:00
fix: Make reports name clearer
This commit is contained in:
1 parent
54aaffed49
commit
f94c8c008f
2 files changed
+6
-6
No files matched your search
+2
-2
@@ -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,
|
||||
|
||||
+4
-4
@@ -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(),
|
||||
|
||||
Reference in new issue
Block a user