forked from mirrors/jj
cli: relax error type of LogContentFormat::write()
This commit is contained in:
parent
6154827129
commit
babdf6b9c1
1 changed files with 6 additions and 5 deletions
|
@ -2359,18 +2359,19 @@ impl LogContentFormat {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Writes content which will optionally be wrapped at the current width.
|
/// Writes content which will optionally be wrapped at the current width.
|
||||||
pub fn write(
|
pub fn write<E: From<io::Error>>(
|
||||||
&self,
|
&self,
|
||||||
formatter: &mut dyn Formatter,
|
formatter: &mut dyn Formatter,
|
||||||
content_fn: impl FnOnce(&mut dyn Formatter) -> std::io::Result<()>,
|
content_fn: impl FnOnce(&mut dyn Formatter) -> Result<(), E>,
|
||||||
) -> std::io::Result<()> {
|
) -> Result<(), E> {
|
||||||
if self.word_wrap {
|
if self.word_wrap {
|
||||||
let mut recorder = FormatRecorder::new();
|
let mut recorder = FormatRecorder::new();
|
||||||
content_fn(&mut recorder)?;
|
content_fn(&mut recorder)?;
|
||||||
text_util::write_wrapped(formatter, &recorder, self.width)
|
text_util::write_wrapped(formatter, &recorder, self.width)?;
|
||||||
} else {
|
} else {
|
||||||
content_fn(formatter)
|
content_fn(formatter)?;
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue