Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix BinaryFile display #1078

Merged
merged 1 commit into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/typos-cli/src/bin/typos-cli/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Report for PrintBrief {
fn report(&self, msg: Message<'_>) -> Result<(), std::io::Error> {
match &msg {
Message::BinaryFile(msg) => {
log::info!("{}", msg);
log::info!("{msg}");
}
Message::Typo(msg) => print_brief_correction(msg)?,
Message::FileType(msg) => {
Expand Down Expand Up @@ -97,7 +97,7 @@ impl Report for PrintLong {
fn report(&self, msg: Message<'_>) -> Result<(), std::io::Error> {
match &msg {
Message::BinaryFile(msg) => {
log::info!("{}", msg);
log::info!("{msg}");
}
Message::Typo(msg) => print_long_correction(msg)?,
Message::FileType(msg) => {
Expand Down
4 changes: 2 additions & 2 deletions crates/typos-cli/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ fn read_file(
let (r, written) = encoding_rs::UTF_16LE.new_decoder_with_bom_removal().decode_to_string_without_replacement(&buffer, &mut decoded, true);
let decoded = match r {
encoding_rs::DecoderResult::InputEmpty => Ok(decoded),
_ => Err(format!("invalid UTF-16LE encoding at byte {} in {}", written, path.display())),
_ => Err(format!("invalid UTF-16LE encoding at byte {written} in {}", path.display())),
};
let buffer = report_result(decoded, Some(path), reporter)?;
(buffer.into_bytes(), content_type)
Expand All @@ -487,7 +487,7 @@ fn read_file(
let (r, written) = encoding_rs::UTF_16BE.new_decoder_with_bom_removal().decode_to_string_without_replacement(&buffer, &mut decoded, true);
let decoded = match r {
encoding_rs::DecoderResult::InputEmpty => Ok(decoded),
_ => Err(format!("invalid UTF-16BE encoding at byte {} in {}", written, path.display())),
_ => Err(format!("invalid UTF-16BE encoding at byte {written} in {}", path.display())),
};
let buffer = report_result(decoded, Some(path), reporter)?;
(buffer.into_bytes(), content_type)
Expand Down
2 changes: 1 addition & 1 deletion crates/typos-cli/src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ impl DirConfig {

let config = name
.and_then(|name| {
log::debug!("{}: `{}` policy", path.display(), name);
log::debug!("{}: `{name}` policy", path.display());
self.types.get(name).copied()
})
.unwrap_or_else(|| {
Expand Down
2 changes: 1 addition & 1 deletion crates/typos-cli/src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<'m> Message<'m> {
}

#[derive(Clone, Debug, serde::Serialize, derive_more::Display, derive_setters::Setters)]
#[display("Skipping binary file {}", "path.display()")]
#[display("Skipping binary file {}", path.display())]
#[non_exhaustive]
pub struct BinaryFile<'m> {
pub path: &'m std::path::Path,
Expand Down
Loading