From d84510367928cb4f45e2d885f278e38116792b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cipriani=20Bandarra?= Date: Fri, 30 Jan 2026 19:29:29 +0000 Subject: [PATCH] Fix Display impl for OllamaError: use write! instead of writeln! The Display trait should not append trailing newlines, as callers like println! and error chaining libraries (anyhow, eyre) add their own. Also cleaned up the display strings to use readable names instead of raw variant names. --- src/error.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/error.rs b/src/error.rs index 07d60cb..db36817 100644 --- a/src/error.rs +++ b/src/error.rs @@ -16,9 +16,9 @@ impl Error for OllamaError {} impl Display for OllamaError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - OllamaError::NetworkError(e) => writeln!(f, "Network error: {}", e), - OllamaError::ResponseParseError(e) => writeln!(f, "ResponseParseError error: {}", e), - OllamaError::LinesCoderError(e) => writeln!(f, "LinesCoderError error: {}", e), + OllamaError::NetworkError(e) => write!(f, "Network error: {}", e), + OllamaError::ResponseParseError(e) => write!(f, "Response parse error: {}", e), + OllamaError::LinesCoderError(e) => write!(f, "Lines codec error: {}", e), } } }