1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

Merge pull request #4760 from cakebaker/test_wc_use_variables_directly_in_format_strings

test,wc: use vars directly in format! strings
This commit is contained in:
Sylvestre Ledru 2023-04-21 10:11:22 +02:00 committed by GitHub
commit fe7dd4071d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -16,12 +16,12 @@ pub type ParseResult<T> = Result<T, ParseError>;
impl std::fmt::Display for ParseError { impl std::fmt::Display for ParseError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::Expected(s) => write!(f, "expected {}", s), Self::Expected(s) => write!(f, "expected {s}"),
Self::ExpectedValue => write!(f, "expected value"), Self::ExpectedValue => write!(f, "expected value"),
Self::MissingArgument(s) => write!(f, "missing argument after {}", s), Self::MissingArgument(s) => write!(f, "missing argument after {s}"),
Self::ExtraArgument(s) => write!(f, "extra argument {}", s), Self::ExtraArgument(s) => write!(f, "extra argument {s}"),
Self::UnknownOperator(s) => write!(f, "unknown operator {}", s), Self::UnknownOperator(s) => write!(f, "unknown operator {s}"),
Self::InvalidInteger(s) => write!(f, "invalid integer {}", s), Self::InvalidInteger(s) => write!(f, "invalid integer {s}"),
} }
} }
} }

View file

@ -28,9 +28,9 @@ impl<'a> fmt::Display for BufReadDecoderError<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self { match *self {
BufReadDecoderError::InvalidByteSequence(bytes) => { BufReadDecoderError::InvalidByteSequence(bytes) => {
write!(f, "invalid byte sequence: {:02x?}", bytes) write!(f, "invalid byte sequence: {bytes:02x?}")
} }
BufReadDecoderError::Io(ref err) => write!(f, "underlying bytestream error: {}", err), BufReadDecoderError::Io(ref err) => write!(f, "underlying bytestream error: {err}"),
} }
} }
} }