Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion linera-base/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub trait CommandExt: std::fmt::Debug {

/// Description used for error reporting.
fn description(&self) -> String {
format!("While executing {:?}", self)
format!("While executing {self:?}")
}
}

Expand Down
4 changes: 2 additions & 2 deletions linera-base/src/crypto/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ impl Ed25519Signature {
{
Ed25519Signature::verify_batch_internal(value, votes).map_err(|error| {
CryptoError::InvalidSignature {
error: format!("batched {}", error),
error: format!("batched {error}"),
type_name: T::type_name().to_string(),
}
})
Expand Down Expand Up @@ -411,7 +411,7 @@ impl<'de> Deserialize<'de> for Ed25519Signature {
impl fmt::Display for Ed25519Signature {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let s = hex::encode(self.0.to_bytes());
write!(f, "{}", s)
write!(f, "{s}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion linera-base/src/crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ where
fn write(&self, hasher: &mut Hasher) {
let name = <Self as HasTypeName>::type_name();
// Note: This assumes that names never contain the separator `::`.
write!(hasher, "{}::", name).expect("Hasher should not fail");
write!(hasher, "{name}::").expect("Hasher should not fail");
bcs::serialize_into(hasher, &self).expect("Message serialization should not fail");
}
}
Expand Down
4 changes: 2 additions & 2 deletions linera-base/src/crypto/secp256k1/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl TryFrom<&[u8]> for EvmPublicKey {
impl fmt::Display for EvmPublicKey {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let str = hex::encode(self.as_bytes());
write!(f, "{}", str)
write!(f, "{str}")
}
}

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

Expand Down
4 changes: 2 additions & 2 deletions linera-base/src/crypto/secp256k1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl TryFrom<&[u8]> for Secp256k1PublicKey {
impl fmt::Display for Secp256k1PublicKey {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let str = hex::encode(self.as_bytes());
write!(f, "{}", str)
write!(f, "{str}")
}
}

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

Expand Down
6 changes: 3 additions & 3 deletions linera-base/src/data_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,9 @@ impl Display for Round {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Round::Fast => write!(f, "fast round"),
Round::MultiLeader(r) => write!(f, "multi-leader round {}", r),
Round::SingleLeader(r) => write!(f, "single-leader round {}", r),
Round::Validator(r) => write!(f, "validator round {}", r),
Round::MultiLeader(r) => write!(f, "multi-leader round {r}"),
Round::SingleLeader(r) => write!(f, "single-leader round {r}"),
Round::Validator(r) => write!(f, "validator round {r}"),
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions linera-base/src/identifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,16 +205,15 @@ impl BlobType {

impl fmt::Display for BlobType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self)
write!(f, "{self:?}")
}
}

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

fn from_str(s: &str) -> Result<Self, Self::Err> {
serde_json::from_str(&format!("\"{s}\""))
.with_context(|| format!("Invalid BlobType: {}", s))
serde_json::from_str(&format!("\"{s}\"")).with_context(|| format!("Invalid BlobType: {s}"))
}
}

Expand Down Expand Up @@ -1015,7 +1014,7 @@ impl fmt::Display for AccountOwner {
AccountOwner::Reserved(value) => {
write!(f, "0x{}", hex::encode(&value.to_be_bytes()[..]))?
}
AccountOwner::Address32(value) => write!(f, "0x{}", value)?,
AccountOwner::Address32(value) => write!(f, "0x{value}")?,
AccountOwner::Address20(value) => write!(f, "0x{}", hex::encode(&value[..]))?,
};

Expand Down
2 changes: 1 addition & 1 deletion linera-base/src/port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ pub async fn get_free_port() -> Result<u16> {
/// Provides a local endpoint that is currently available
pub async fn get_free_endpoint() -> Result<String> {
let port = get_free_port().await?;
Ok(format!("127.0.0.1:{}", port))
Ok(format!("127.0.0.1:{port}"))
}
2 changes: 1 addition & 1 deletion linera-chain/src/unit_tests/data_types_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{
};

fn dummy_chain_id(index: u32) -> ChainId {
ChainId(CryptoHash::test_hash(format!("chain{}", index)))
ChainId(CryptoHash::test_hash(format!("chain{index}")))
}

#[test]
Expand Down
6 changes: 3 additions & 3 deletions linera-core/src/unit_tests/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ where
Ok(certificates) => match ResultReadCertificates::new(certificates, hashes) {
ResultReadCertificates::Certificates(certificates) => Ok(certificates),
ResultReadCertificates::InvalidHashes(hashes) => {
panic!("Missing certificates: {:?}", hashes)
panic!("Missing certificates: {hashes:?}")
}
},
};
Expand Down Expand Up @@ -802,7 +802,7 @@ where
let validator_public_key = validator_keypair.public_key;
let storage = storage_builder.build().await?;
let state = WorkerState::new(
format!("Node {}", i),
format!("Node {i}"),
Some(validator_keypair.secret_key),
storage.clone(),
)
Expand Down Expand Up @@ -999,7 +999,7 @@ where
self.admin_id(),
false,
[chain_id],
format!("Client node for {:.8}", chain_id),
format!("Client node for {chain_id:.8}"),
Duration::from_secs(30),
ChainClientOptions::test_default(),
));
Expand Down
2 changes: 1 addition & 1 deletion linera-ethereum/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub fn event_name_from_expanded(event_name_expanded: &str) -> String {
fn parse_entry(entry: B256, ethereum_type: &str) -> Result<EthereumDataType, EthereumServiceError> {
if ethereum_type == "address" {
let address = Address::from_word(entry);
let address = format!("{:?}", address);
let address = format!("{address:?}");
return Ok(EthereumDataType::Address(address));
}
if ethereum_type == "uint256" {
Expand Down
6 changes: 3 additions & 3 deletions linera-ethereum/src/test_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub async fn get_anvil() -> anyhow::Result<AnvilTest> {
impl AnvilTest {
pub fn get_address(&self, index: usize) -> String {
let address = self.anvil_instance.addresses()[index];
format!("{:?}", address)
format!("{address:?}")
}
}

Expand All @@ -111,7 +111,7 @@ impl SimpleTokenContractFunction {
SimpleTokenContract::deploy(&anvil_test.ethereum_client.provider, initial_supply)
.await?;
let contract_address = simple_token.address();
let contract_address = format!("{:?}", contract_address);
let contract_address = format!("{contract_address:?}");
Ok(Self {
contract_address,
anvil_test,
Expand Down Expand Up @@ -173,7 +173,7 @@ impl EventNumericsContractFunction {
.await?;
// Getting the contract address
let contract_address = event_numerics.address();
let contract_address = format!("{:?}", contract_address);
let contract_address = format!("{contract_address:?}");
Ok(Self {
contract_address,
anvil_test,
Expand Down
2 changes: 1 addition & 1 deletion linera-execution/src/evm/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ where
// concept in Linera
let basefee = 0;
let chain_id = runtime.chain_id()?;
let entry = format!("{}{}", chain_id, block_height_linera);
let entry = format!("{chain_id}{block_height_linera}");
// The randomness beacon being used.
let prevrandao = keccak256(entry.as_bytes());
// The blob excess gas and price is not relevant to the execution
Expand Down
4 changes: 2 additions & 2 deletions linera-execution/src/evm/revm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ where
inspector,
)
.map_err(|error| {
let error = format!("{:?}", error);
let error = format!("{error:?}");
EvmExecutionError::TransactCommitError(error)
})
}?;
Expand Down Expand Up @@ -1486,7 +1486,7 @@ where
inspector,
)
.map_err(|error| {
let error = format!("{:?}", error);
let error = format!("{error:?}");
EvmExecutionError::TransactCommitError(error)
})
}?;
Expand Down
4 changes: 2 additions & 2 deletions linera-execution/src/test_utils/solidity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub fn get_bytecode(source_code: &str, contract_name: &str) -> anyhow::Result<Ve
] {
let test_code_path = path.join(file_name);
let mut test_code_file = File::create(&test_code_path)?;
writeln!(test_code_file, "{}", literal_path)?;
writeln!(test_code_file, "{literal_path}")?;
}
}
if source_code.contains("@openzeppelin") {
Expand All @@ -111,7 +111,7 @@ pub fn get_bytecode(source_code: &str, contract_name: &str) -> anyhow::Result<Ve
let file_name = "test_code.sol";
let test_code_path = path.join(file_name);
let mut test_code_file = File::create(&test_code_path)?;
writeln!(test_code_file, "{}", source_code)?;
writeln!(test_code_file, "{source_code}")?;
get_bytecode_path(path, file_name, contract_name)
}

Expand Down
4 changes: 2 additions & 2 deletions linera-explorer/src/entrypoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn forge_arg_type(arg: &Value, non_null: bool) -> Option<String> {
.iter()
.filter_map(|x| {
let name = x["name"].as_str().unwrap();
forge_arg_type(&x["type"], false).map(|arg| format!("{}: {}", name, arg))
forge_arg_type(&x["type"], false).map(|arg| format!("{name}: {arg}"))
})
.collect::<Vec<_>>();
Some(format!("{{{}}}", args.join(", ")))
Expand Down Expand Up @@ -126,7 +126,7 @@ pub async fn query(app: JsValue, query: JsValue, kind: String) {
let name = fetch_json["name"].as_str().unwrap();
let args = fetch_json["args"].as_array().unwrap().to_vec();
let args = forge_args(args);
let input = format!("{}{}", name, args);
let input = format!("{name}{args}");
let response = forge_response(&fetch_json["type"]);
let body =
serde_json::json!({ "query": format!("{} {{{} {}}}", kind, input, response) }).to_string();
Expand Down
2 changes: 1 addition & 1 deletion linera-explorer/src/graphql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub async fn introspection(url: &str) -> Result<Value> {
ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType {kind name} } } } } } } }";
let res = client
.post(url)
.body(format!("{{\"query\":\"{}\"}}", graphql_query))
.body(format!("{{\"query\":\"{graphql_query}\"}}"))
.send()
.await?
.text()
Expand Down
4 changes: 2 additions & 2 deletions linera-explorer/src/js_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ pub const SER: Serializer =

pub fn setf(target: &JsValue, field: &str, value: &JsValue) {
js_sys::Reflect::set(target, &JsValue::from_str(field), value)
.unwrap_or_else(|_| panic!("failed to set JS field '{}'", field));
.unwrap_or_else(|_| panic!("failed to set JS field '{field}'"));
}

pub fn getf(target: &JsValue, field: &str) -> JsValue {
js_sys::Reflect::get(target, &JsValue::from_str(field))
.unwrap_or_else(|_| panic!("failed to get JS field '{}'", field))
.unwrap_or_else(|_| panic!("failed to get JS field '{field}'"))
}

pub fn log(x: &JsValue) {
Expand Down
Loading
Loading