Skip to content

Commit db1915b

Browse files
committed
Fix clippy
1 parent e1d3a28 commit db1915b

File tree

27 files changed

+141
-152
lines changed

27 files changed

+141
-152
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-chain/src/unit_tests/data_types_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{
1414
};
1515

1616
fn dummy_chain_id(index: u32) -> ChainId {
17-
ChainId(CryptoHash::test_hash(format!("chain{}", index)))
17+
ChainId(CryptoHash::test_hash(format!("chain{index}")))
1818
}
1919

2020
#[test]

linera-core/src/unit_tests/test_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ where
588588
Ok(certificates) => match ResultReadCertificates::new(certificates, hashes) {
589589
ResultReadCertificates::Certificates(certificates) => Ok(certificates),
590590
ResultReadCertificates::InvalidHashes(hashes) => {
591-
panic!("Missing certificates: {:?}", hashes)
591+
panic!("Missing certificates: {hashes:?}")
592592
}
593593
},
594594
};
@@ -802,7 +802,7 @@ where
802802
let validator_public_key = validator_keypair.public_key;
803803
let storage = storage_builder.build().await?;
804804
let state = WorkerState::new(
805-
format!("Node {}", i),
805+
format!("Node {i}"),
806806
Some(validator_keypair.secret_key),
807807
storage.clone(),
808808
)
@@ -999,7 +999,7 @@ where
999999
self.admin_id(),
10001000
false,
10011001
[chain_id],
1002-
format!("Client node for {:.8}", chain_id),
1002+
format!("Client node for {chain_id:.8}"),
10031003
Duration::from_secs(30),
10041004
ChainClientOptions::test_default(),
10051005
));

0 commit comments

Comments
 (0)