From 98fb8fa1440c7f00369393a5310d3dc91b0c712a Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 21 Apr 2023 08:32:49 +0200 Subject: [PATCH] test,wc: use vars directly in format! strings --- src/uu/test/src/error.rs | 10 +++++----- src/uu/wc/src/utf8/read.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/uu/test/src/error.rs b/src/uu/test/src/error.rs index e9ab1c082..ced4b216a 100644 --- a/src/uu/test/src/error.rs +++ b/src/uu/test/src/error.rs @@ -16,12 +16,12 @@ pub type ParseResult = Result; impl std::fmt::Display for ParseError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Self::Expected(s) => write!(f, "expected {}", s), + Self::Expected(s) => write!(f, "expected {s}"), Self::ExpectedValue => write!(f, "expected value"), - Self::MissingArgument(s) => write!(f, "missing argument after {}", s), - Self::ExtraArgument(s) => write!(f, "extra argument {}", s), - Self::UnknownOperator(s) => write!(f, "unknown operator {}", s), - Self::InvalidInteger(s) => write!(f, "invalid integer {}", s), + Self::MissingArgument(s) => write!(f, "missing argument after {s}"), + Self::ExtraArgument(s) => write!(f, "extra argument {s}"), + Self::UnknownOperator(s) => write!(f, "unknown operator {s}"), + Self::InvalidInteger(s) => write!(f, "invalid integer {s}"), } } } diff --git a/src/uu/wc/src/utf8/read.rs b/src/uu/wc/src/utf8/read.rs index 79b8ad8ae..eb4684f7f 100644 --- a/src/uu/wc/src/utf8/read.rs +++ b/src/uu/wc/src/utf8/read.rs @@ -28,9 +28,9 @@ impl<'a> fmt::Display for BufReadDecoderError<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { 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}"), } } }