Mercurial > public > mercurial-scm > hg-stable
diff rust/rhg/src/ui.rs @ 45999:fada33872b5b
rhg: use `format_bytes!` for error messages
This change also includes a formatting changing with the new `rustfmt` version,
but I'm expecting it to have already been applied in another patch by the time
this lands.
Differential Revision: https://phab.mercurial-scm.org/D9407
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Thu, 26 Nov 2020 09:54:16 +0100 |
parents | 66756b34c06e |
children | 21d3b40b4c0e |
line wrap: on
line diff
--- a/rust/rhg/src/ui.rs Mon Nov 30 10:18:36 2020 +0100 +++ b/rust/rhg/src/ui.rs Thu Nov 26 09:54:16 2020 +0100 @@ -1,3 +1,4 @@ +use format_bytes::format_bytes; use std::borrow::Cow; use std::io; use std::io::{ErrorKind, Write}; @@ -87,7 +88,10 @@ let mut stderr = io::stderr(); stderr - .write_all(&[b"abort: ", error.to_string().as_bytes(), b"\n"].concat()) + .write_all(&format_bytes!( + b"abort: {}\n", + error.to_string().as_bytes() + )) .map_err(UiError::StderrError)?; stderr.flush().map_err(UiError::StderrError)?;