From babdf6b9c1a4e1968d721f060416b2401ee1dc87 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Tue, 3 Sep 2024 18:28:00 +0900 Subject: [PATCH] cli: relax error type of LogContentFormat::write() --- cli/src/cli_util.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index b995963b0..670c4e9e7 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -2359,18 +2359,19 @@ impl LogContentFormat { } /// Writes content which will optionally be wrapped at the current width. - pub fn write( + pub fn write>( &self, formatter: &mut dyn Formatter, - content_fn: impl FnOnce(&mut dyn Formatter) -> std::io::Result<()>, - ) -> std::io::Result<()> { + content_fn: impl FnOnce(&mut dyn Formatter) -> Result<(), E>, + ) -> Result<(), E> { if self.word_wrap { let mut recorder = FormatRecorder::new(); content_fn(&mut recorder)?; - text_util::write_wrapped(formatter, &recorder, self.width) + text_util::write_wrapped(formatter, &recorder, self.width)?; } else { - content_fn(formatter) + content_fn(formatter)?; } + Ok(()) } }