mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 00:51:11 -05:00
fix: Make reports name clearer
This commit is contained in:
parent
54aaffed49
commit
f94c8c008f
2 changed files with 6 additions and 6 deletions
|
@ -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,
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Reference in a new issue