Skip to content

Commit d01b552

Browse files
committed
Fix all clippy warnings
1 parent e1d3a28 commit d01b552

File tree

19 files changed

+121
-140
lines changed

19 files changed

+121
-140
lines changed

linera-base/src/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub trait CommandExt: std::fmt::Debug {
137137

138138
/// Description used for error reporting.
139139
fn description(&self) -> String {
140-
format!("While executing {:?}", self)
140+
format!("While executing {self:?}")
141141
}
142142
}
143143

linera-base/src/crypto/ed25519.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ impl Ed25519Signature {
363363
{
364364
Ed25519Signature::verify_batch_internal(value, votes).map_err(|error| {
365365
CryptoError::InvalidSignature {
366-
error: format!("batched {}", error),
366+
error: format!("batched {error}"),
367367
type_name: T::type_name().to_string(),
368368
}
369369
})
@@ -411,7 +411,7 @@ impl<'de> Deserialize<'de> for Ed25519Signature {
411411
impl fmt::Display for Ed25519Signature {
412412
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
413413
let s = hex::encode(self.0.to_bytes());
414-
write!(f, "{}", s)
414+
write!(f, "{s}")
415415
}
416416
}
417417

linera-base/src/crypto/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ where
399399
fn write(&self, hasher: &mut Hasher) {
400400
let name = <Self as HasTypeName>::type_name();
401401
// Note: This assumes that names never contain the separator `::`.
402-
write!(hasher, "{}::", name).expect("Hasher should not fail");
402+
write!(hasher, "{name}::").expect("Hasher should not fail");
403403
bcs::serialize_into(hasher, &self).expect("Message serialization should not fail");
404404
}
405405
}

linera-base/src/crypto/secp256k1/evm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl TryFrom<&[u8]> for EvmPublicKey {
239239
impl fmt::Display for EvmPublicKey {
240240
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
241241
let str = hex::encode(self.as_bytes());
242-
write!(f, "{}", str)
242+
write!(f, "{str}")
243243
}
244244
}
245245

@@ -553,7 +553,7 @@ impl<'de> Deserialize<'de> for EvmSignature {
553553
impl fmt::Display for EvmSignature {
554554
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
555555
let s = hex::encode(self.as_bytes());
556-
write!(f, "{}", s)
556+
write!(f, "{s}")
557557
}
558558
}
559559

linera-base/src/crypto/secp256k1/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl TryFrom<&[u8]> for Secp256k1PublicKey {
184184
impl fmt::Display for Secp256k1PublicKey {
185185
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
186186
let str = hex::encode(self.as_bytes());
187-
write!(f, "{}", str)
187+
write!(f, "{str}")
188188
}
189189
}
190190

@@ -459,7 +459,7 @@ impl<'de> Deserialize<'de> for Secp256k1Signature {
459459
impl fmt::Display for Secp256k1Signature {
460460
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
461461
let s = hex::encode(self.as_bytes());
462-
write!(f, "{}", s)
462+
write!(f, "{s}")
463463
}
464464
}
465465

linera-base/src/data_types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,9 +615,9 @@ impl Display for Round {
615615
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
616616
match self {
617617
Round::Fast => write!(f, "fast round"),
618-
Round::MultiLeader(r) => write!(f, "multi-leader round {}", r),
619-
Round::SingleLeader(r) => write!(f, "single-leader round {}", r),
620-
Round::Validator(r) => write!(f, "validator round {}", r),
618+
Round::MultiLeader(r) => write!(f, "multi-leader round {r}"),
619+
Round::SingleLeader(r) => write!(f, "single-leader round {r}"),
620+
Round::Validator(r) => write!(f, "validator round {r}"),
621621
}
622622
}
623623
}

linera-base/src/identifiers.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,15 @@ impl BlobType {
205205

206206
impl fmt::Display for BlobType {
207207
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
208-
write!(f, "{:?}", self)
208+
write!(f, "{self:?}")
209209
}
210210
}
211211

212212
impl std::str::FromStr for BlobType {
213213
type Err = anyhow::Error;
214214

215215
fn from_str(s: &str) -> Result<Self, Self::Err> {
216-
serde_json::from_str(&format!("\"{s}\""))
217-
.with_context(|| format!("Invalid BlobType: {}", s))
216+
serde_json::from_str(&format!("\"{s}\"")).with_context(|| format!("Invalid BlobType: {s}"))
218217
}
219218
}
220219

@@ -1015,7 +1014,7 @@ impl fmt::Display for AccountOwner {
10151014
AccountOwner::Reserved(value) => {
10161015
write!(f, "0x{}", hex::encode(&value.to_be_bytes()[..]))?
10171016
}
1018-
AccountOwner::Address32(value) => write!(f, "0x{}", value)?,
1017+
AccountOwner::Address32(value) => write!(f, "0x{value}")?,
10191018
AccountOwner::Address20(value) => write!(f, "0x{}", hex::encode(&value[..]))?,
10201019
};
10211020

linera-base/src/port.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ pub async fn get_free_port() -> Result<u16> {
2323
/// Provides a local endpoint that is currently available
2424
pub async fn get_free_endpoint() -> Result<String> {
2525
let port = get_free_port().await?;
26-
Ok(format!("127.0.0.1:{}", port))
26+
Ok(format!("127.0.0.1:{port}"))
2727
}

linera-base/src/prometheus_util.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,7 @@ mod tests {
152152
for (i, (l, r)) in left.iter().zip(right.iter()).enumerate() {
153153
assert!(
154154
(l - r).abs() < EPSILON,
155-
"Vectors differ at index {}: {} != {}",
156-
i,
157-
l,
158-
r
155+
"Vectors differ at index {i}: {l} != {r}"
159156
);
160157
}
161158
}

linera-ethereum/src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub fn event_name_from_expanded(event_name_expanded: &str) -> String {
102102
fn parse_entry(entry: B256, ethereum_type: &str) -> Result<EthereumDataType, EthereumServiceError> {
103103
if ethereum_type == "address" {
104104
let address = Address::from_word(entry);
105-
let address = format!("{:?}", address);
105+
let address = format!("{address:?}");
106106
return Ok(EthereumDataType::Address(address));
107107
}
108108
if ethereum_type == "uint256" {

0 commit comments

Comments
 (0)