From 1fb9ef5abcbfdf1e1c0426ff94c11d3a8cb6acb2 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 10 Nov 2021 21:56:04 -0500 Subject: [PATCH 1/2] remove trailing blank lines in error messages --- src/error.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/error.rs b/src/error.rs index f680b4786..b4c025ae3 100644 --- a/src/error.rs +++ b/src/error.rs @@ -49,11 +49,11 @@ pub struct FinalError { impl Display for FinalError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // Title - writeln!(f, "{}[ERROR]{} {}", *RED, *RESET, self.title)?; + write!(f, "{}[ERROR]{} {}", *RED, *RESET, self.title)?; // Details for detail in &self.details { - writeln!(f, " {}-{} {}", *WHITE, *YELLOW, detail)?; + write!(f, "\n {}-{} {}", *WHITE, *YELLOW, detail)?; } // Hints @@ -61,7 +61,7 @@ impl Display for FinalError { // Separate by one blank line. writeln!(f)?; for hint in &self.hints { - writeln!(f, "{}hint:{} {}", *GREEN, *RESET, hint)?; + write!(f, "\n{}hint:{} {}", *GREEN, *RESET, hint)?; } } From 5616231af926e991d0f6195d24a5b73362b4c6ae Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 10 Nov 2021 21:59:07 -0500 Subject: [PATCH 2/2] simplify colors --- src/error.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/error.rs b/src/error.rs index b4c025ae3..d9ac44997 100644 --- a/src/error.rs +++ b/src/error.rs @@ -53,7 +53,7 @@ impl Display for FinalError { // Details for detail in &self.details { - write!(f, "\n {}-{} {}", *WHITE, *YELLOW, detail)?; + write!(f, "\n - {}{}{}", *YELLOW, detail, *RESET)?; } // Hints @@ -65,7 +65,7 @@ impl Display for FinalError { } } - write!(f, "{}", *RESET) + Ok(()) } }