From f15191de14fa27d22e1cb6b9317437f0404abe51 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 7 Aug 2019 08:25:55 -0500 Subject: [PATCH] refactor(report): Leverage derive_more, more --- src/report.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/report.rs b/src/report.rs index 96f0957..0c6adc3 100644 --- a/src/report.rs +++ b/src/report.rs @@ -10,7 +10,8 @@ pub enum Message<'m> { FilenameCorrection(FilenameCorrection<'m>), } -#[derive(Clone, Debug, serde::Serialize)] +#[derive(Clone, Debug, serde::Serialize, derive_more::Display)] +#[display(fmt = "Skipping binary file {}", "path.display()")] pub struct BinaryFile<'m> { pub path: &'m std::path::Path, #[serde(skip)] @@ -46,7 +47,7 @@ pub fn print_silent(_: Message) {} pub fn print_brief(msg: Message) { match msg { Message::BinaryFile(msg) => { - println!("Skipping binary file {}", msg.path.display(),); + println!("{}", msg); } Message::Correction(msg) => { println!( @@ -67,7 +68,7 @@ pub fn print_brief(msg: Message) { pub fn print_long(msg: Message) { match msg { Message::BinaryFile(msg) => { - println!("Skipping binary file {}", msg.path.display(),); + println!("{}", msg); } Message::Correction(msg) => print_long_correction(msg), Message::FilenameCorrection(msg) => {