mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-25 10:31:02 -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()) {
|
if let Some(part) = path.file_name().and_then(|s| s.to_str()) {
|
||||||
for ident in parser.parse(part) {
|
for ident in parser.parse(part) {
|
||||||
if let Some(correction) = dictionary.correct_ident(ident) {
|
if let Some(correction) = dictionary.correct_ident(ident) {
|
||||||
let msg = report::FilenameCorrection {
|
let msg = report::PathCorrection {
|
||||||
path,
|
path,
|
||||||
typo: ident.token(),
|
typo: ident.token(),
|
||||||
correction,
|
correction,
|
||||||
|
@ -249,7 +249,7 @@ impl Checks {
|
||||||
} else {
|
} else {
|
||||||
for word in ident.split() {
|
for word in ident.split() {
|
||||||
if let Some(correction) = dictionary.correct_word(word) {
|
if let Some(correction) = dictionary.correct_word(word) {
|
||||||
let msg = report::FilenameCorrection {
|
let msg = report::PathCorrection {
|
||||||
path,
|
path,
|
||||||
typo: word.token(),
|
typo: word.token(),
|
||||||
correction,
|
correction,
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::io::{self, Write};
|
||||||
pub enum Message<'m> {
|
pub enum Message<'m> {
|
||||||
BinaryFile(BinaryFile<'m>),
|
BinaryFile(BinaryFile<'m>),
|
||||||
Correction(Correction<'m>),
|
Correction(Correction<'m>),
|
||||||
FilenameCorrection(FilenameCorrection<'m>),
|
PathCorrection(PathCorrection<'m>),
|
||||||
File(File<'m>),
|
File(File<'m>),
|
||||||
Parse(Parse<'m>),
|
Parse(Parse<'m>),
|
||||||
PathError(PathError<'m>),
|
PathError(PathError<'m>),
|
||||||
|
@ -38,7 +38,7 @@ pub struct Correction<'m> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, serde::Serialize)]
|
#[derive(Clone, Debug, serde::Serialize)]
|
||||||
pub struct FilenameCorrection<'m> {
|
pub struct PathCorrection<'m> {
|
||||||
pub path: &'m std::path::Path,
|
pub path: &'m std::path::Path,
|
||||||
pub typo: &'m str,
|
pub typo: &'m str,
|
||||||
pub correction: Cow<'m, str>,
|
pub correction: Cow<'m, str>,
|
||||||
|
@ -133,7 +133,7 @@ impl Report for PrintBrief {
|
||||||
msg.correction
|
msg.correction
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Message::FilenameCorrection(msg) => {
|
Message::PathCorrection(msg) => {
|
||||||
println!("{}: {} -> {}", msg.path.display(), msg.typo, msg.correction);
|
println!("{}: {} -> {}", msg.path.display(), msg.typo, msg.correction);
|
||||||
}
|
}
|
||||||
Message::File(msg) => {
|
Message::File(msg) => {
|
||||||
|
@ -165,7 +165,7 @@ impl Report for PrintLong {
|
||||||
println!("{}", msg);
|
println!("{}", msg);
|
||||||
}
|
}
|
||||||
Message::Correction(msg) => print_long_correction(msg),
|
Message::Correction(msg) => print_long_correction(msg),
|
||||||
Message::FilenameCorrection(msg) => {
|
Message::PathCorrection(msg) => {
|
||||||
println!(
|
println!(
|
||||||
"{}: error: `{}` should be `{}`",
|
"{}: error: `{}` should be `{}`",
|
||||||
msg.path.display(),
|
msg.path.display(),
|
||||||
|
|
Loading…
Reference in a new issue