Skip to content

Commit 915474f

Browse files
authored
Fix clippy::uninlined_format_args (#1858)
1 parent d7807bf commit 915474f

File tree

6 files changed

+17
-20
lines changed

6 files changed

+17
-20
lines changed

.github/workflows/workspace.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- uses: RustCrypto/actions/cargo-cache@master
2525
- uses: dtolnay/rust-toolchain@master
2626
with:
27-
toolchain: 1.85.0
27+
toolchain: 1.87.0
2828
components: clippy
2929
- run: cargo clippy --all --all-features --tests -- -D warnings
3030

password-hash/src/errors.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,28 @@ impl fmt::Display for Error {
7272
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> core::result::Result<(), fmt::Error> {
7373
match self {
7474
Self::Algorithm => write!(f, "unsupported algorithm"),
75-
Self::B64Encoding(err) => write!(f, "{}", err),
75+
Self::B64Encoding(err) => write!(f, "{err}"),
7676
Self::Crypto => write!(f, "cryptographic error"),
7777
Self::OutputSize { provided, expected } => match provided {
7878
Ordering::Less => write!(
7979
f,
80-
"output size too short, expected at least {} bytes",
81-
expected
82-
),
83-
Ordering::Equal => write!(f, "output size unexpected, expected {} bytes", expected),
84-
Ordering::Greater => write!(
85-
f,
86-
"output size too long, expected at most {} bytes",
87-
expected
80+
"output size too short, expected at least {expected} bytes",
8881
),
82+
Ordering::Equal => write!(f, "output size unexpected, expected {expected} bytes"),
83+
Ordering::Greater => {
84+
write!(f, "output size too long, expected at most {expected} bytes")
85+
}
8986
},
9087
Self::ParamNameDuplicated => f.write_str("duplicate parameter"),
9188
Self::ParamNameInvalid => f.write_str("invalid parameter name"),
92-
Self::ParamValueInvalid(val_err) => write!(f, "invalid parameter value: {}", val_err),
89+
Self::ParamValueInvalid(val_err) => write!(f, "invalid parameter value: {val_err}"),
9390
Self::ParamsMaxExceeded => f.write_str("maximum number of parameters reached"),
9491
Self::Password => write!(f, "invalid password"),
9592
Self::PhcStringField => write!(f, "password hash string missing field"),
9693
Self::PhcStringTrailingData => {
9794
write!(f, "password hash string contains trailing characters")
9895
}
99-
Self::SaltInvalid(val_err) => write!(f, "salt invalid: {}", val_err),
96+
Self::SaltInvalid(val_err) => write!(f, "salt invalid: {val_err}"),
10097
Self::Version => write!(f, "invalid algorithm version"),
10198
Self::OutOfMemory => write!(f, "out of memory"),
10299
}
@@ -161,7 +158,7 @@ impl InvalidValue {
161158
impl fmt::Display for InvalidValue {
162159
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> core::result::Result<(), fmt::Error> {
163160
match self {
164-
Self::InvalidChar(c) => write!(f, "contains invalid character: '{}'", c),
161+
Self::InvalidChar(c) => write!(f, "contains invalid character: '{c}'"),
165162
Self::InvalidFormat => f.write_str("value format is invalid"),
166163
Self::Malformed => f.write_str("value malformed"),
167164
Self::TooLong => f.write_str("value to long"),

password-hash/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,18 +253,18 @@ impl fmt::Display for PasswordHash<'_> {
253253
write!(f, "{}{}", PASSWORD_HASH_SEPARATOR, self.algorithm)?;
254254

255255
if let Some(version) = self.version {
256-
write!(f, "{}v={}", PASSWORD_HASH_SEPARATOR, version)?;
256+
write!(f, "{PASSWORD_HASH_SEPARATOR}v={version}")?;
257257
}
258258

259259
if !self.params.is_empty() {
260260
write!(f, "{}{}", PASSWORD_HASH_SEPARATOR, self.params)?;
261261
}
262262

263263
if let Some(salt) = &self.salt {
264-
write!(f, "{}{}", PASSWORD_HASH_SEPARATOR, salt)?;
264+
write!(f, "{PASSWORD_HASH_SEPARATOR}{salt}")?;
265265

266266
if let Some(hash) = &self.hash {
267-
write!(f, "{}{}", PASSWORD_HASH_SEPARATOR, hash)?;
267+
write!(f, "{PASSWORD_HASH_SEPARATOR}{hash}")?;
268268
}
269269
}
270270

password-hash/src/output.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl fmt::Display for Output {
272272

273273
impl fmt::Debug for Output {
274274
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
275-
write!(f, "Output(\"{}\")", self)
275+
write!(f, "Output(\"{self}\")")
276276
}
277277
}
278278

password-hash/src/params.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl ParamsString {
6060

6161
// Add param name
6262
let offset = self.0.length;
63-
if write!(self.0, "{}=", name).is_err() {
63+
if write!(self.0, "{name}=").is_err() {
6464
self.0.length = offset;
6565
return Err(Error::ParamsMaxExceeded);
6666
}
@@ -160,7 +160,7 @@ impl ParamsString {
160160
.map_err(|_| Error::ParamsMaxExceeded)?
161161
}
162162

163-
if write!(self.0, "{}={}", name, value).is_err() {
163+
if write!(self.0, "{name}={value}").is_err() {
164164
self.0.length = orig_len;
165165
return Err(Error::ParamsMaxExceeded);
166166
}

signature/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl Debug for Error {
6161
f.write_str("signature::Error { source: ")?;
6262

6363
if let Some(source) = &self.source {
64-
write!(f, "Some({})", source)?;
64+
write!(f, "Some({source})")?;
6565
} else {
6666
f.write_str("None")?;
6767
}

0 commit comments

Comments
 (0)