diff --git a/cli/src/commands/explore/mod.rs b/cli/src/commands/explore/mod.rs index 6070c1adb8..a74a49e45f 100644 --- a/cli/src/commands/explore/mod.rs +++ b/cli/src/commands/explore/mod.rs @@ -239,7 +239,7 @@ fn pallets_as_string(metadata: &Metadata) -> String { let mut strings: Vec<_> = metadata.pallets().map(|p| p.name()).collect(); strings.sort(); for pallet in strings { - write!(output, "\n {}", pallet).unwrap(); + write!(output, "\n {pallet}").unwrap(); } output } @@ -254,7 +254,7 @@ pub fn runtime_apis_as_string(metadata: &Metadata) -> String { let mut strings: Vec<_> = metadata.runtime_api_traits().map(|p| p.name()).collect(); strings.sort(); for api in strings { - write!(output, "\n {}", api).unwrap(); + write!(output, "\n {api}").unwrap(); } output } diff --git a/cli/src/commands/explore/pallets/storage.rs b/cli/src/commands/explore/pallets/storage.rs index f09ecb1c3e..c258f9a801 100644 --- a/cli/src/commands/explore/pallets/storage.rs +++ b/cli/src/commands/explore/pallets/storage.rs @@ -206,10 +206,8 @@ fn storage_entries_string(storage_metadata: &StorageMetadata, pallet_name: &str) if storage_metadata.entries().is_empty() { format!("No {storage_entry_placeholder}'s available in the \"{pallet_name}\" pallet.") } else { - let mut output = format!( - "Available {storage_entry_placeholder}'s in the \"{}\" pallet:", - pallet_name - ); + let mut output = + format!("Available {storage_entry_placeholder}'s in the \"{pallet_name}\" pallet:"); let mut strings: Vec<_> = storage_metadata .entries() .iter() @@ -217,7 +215,7 @@ fn storage_entries_string(storage_metadata: &StorageMetadata, pallet_name: &str) .collect(); strings.sort(); for entry in strings { - write!(output, "\n {}", entry).unwrap(); + write!(output, "\n {entry}").unwrap(); } output } diff --git a/codegen/src/api/pallet_view_functions.rs b/codegen/src/api/pallet_view_functions.rs index e2b5c938de..2a1b9932c9 100644 --- a/codegen/src/api/pallet_view_functions.rs +++ b/codegen/src/api/pallet_view_functions.rs @@ -50,20 +50,20 @@ fn generate_pallet_view_function( // just be an underscore, so fix any such names we find to work in structs. let mut name = input.name.trim_start_matches('_').to_string(); if name.is_empty() { - name = format!("_{}", idx); + name = format!("_{idx}"); } while !unique_names.insert(name.clone()) { - name = format!("{}_param{}", name, idx); + name = format!("{name}_param{idx}"); } // The alias type name is based on the name, above. let mut alias = name.to_upper_camel_case(); // Note: name is not empty. if alias.as_bytes()[0].is_ascii_digit() { - alias = format!("Param{}", alias); + alias = format!("Param{alias}"); } while !unique_aliases.insert(alias.clone()) { - alias = format!("{}Param{}", alias, idx); + alias = format!("{alias}Param{idx}"); } // Path to the actual type we'll have generated for this input. diff --git a/codegen/src/api/runtime_apis.rs b/codegen/src/api/runtime_apis.rs index a1653ccb4f..d669313165 100644 --- a/codegen/src/api/runtime_apis.rs +++ b/codegen/src/api/runtime_apis.rs @@ -57,20 +57,20 @@ fn generate_runtime_api( // just be an underscore, so fix any such names we find to work in structs. let mut name = input.name.trim_start_matches('_').to_string(); if name.is_empty() { - name = format!("_{}", idx); + name = format!("_{idx}"); } while !unique_names.insert(name.clone()) { // Name is already used, append the index until it is unique. - name = format!("{}_param{}", name, idx); + name = format!("{name}_param{idx}"); } let mut alias = name.to_upper_camel_case(); // Note: name is not empty. if alias.as_bytes()[0].is_ascii_digit() { - alias = format!("Param{}", alias); + alias = format!("Param{alias}"); } while !unique_aliases.insert(alias.clone()) { - alias = format!("{}Param{}", alias, idx); + alias = format!("{alias}Param{idx}"); } let (alias_name, name) = (format_ident!("{alias}"), format_ident!("{name}")); diff --git a/core/src/utils/wrapper_opaque.rs b/core/src/utils/wrapper_opaque.rs index ab7e495766..3cb6781fcf 100644 --- a/core/src/utils/wrapper_opaque.rs +++ b/core/src/utils/wrapper_opaque.rs @@ -93,7 +93,7 @@ impl EncodeAsType for WrapperKeepOpaque { types .resolve_type(type_id.clone(), visitor) - .map_err(|_| Error::new(ErrorKind::TypeNotFound(format!("{:?}", type_id))))? + .map_err(|_| Error::new(ErrorKind::TypeNotFound(format!("{type_id:?}"))))? } } diff --git a/lightclient/src/background.rs b/lightclient/src/background.rs index 510effbe50..47faa47cca 100644 --- a/lightclient/src/background.rs +++ b/lightclient/src/background.rs @@ -278,8 +278,7 @@ impl BackgroundTaskData { None => "null", }; let request = format!( - r#"{{"jsonrpc":"2.0","id":"{}", "method":"{}","params":{}}}"#, - id, method, params + r#"{{"jsonrpc":"2.0","id":"{id}", "method":"{method}","params":{params}}}"# ); self.requests.insert(id, sender); @@ -328,8 +327,7 @@ impl BackgroundTaskData { None => "null", }; let request = format!( - r#"{{"jsonrpc":"2.0","id":"{}", "method":"{}","params":{}}}"#, - id, method, params + r#"{{"jsonrpc":"2.0","id":"{id}", "method":"{method}","params":{params}}}"# ); tracing::trace!(target: LOG_TARGET, "Tracking subscription request id={id} chain={chain_id:?}"); diff --git a/lightclient/src/platform/wasm_platform.rs b/lightclient/src/platform/wasm_platform.rs index 8390fe37be..ade56ecd21 100644 --- a/lightclient/src/platform/wasm_platform.rs +++ b/lightclient/src/platform/wasm_platform.rs @@ -114,28 +114,28 @@ impl PlatformRef for SubxtPlatform { port, secure: true, } => { - format!("wss://{}:{}", hostname, port) + format!("wss://{hostname}:{port}") } Address::WebSocketDns { hostname, port, secure: false, } => { - format!("ws://{}:{}", hostname, port) + format!("ws://{hostname}:{port}") } Address::WebSocketIp { ip: IpAddr::V4(ip), port, } => { let addr = SocketAddr::from((ip, port)); - format!("ws://{}", addr) + format!("ws://{addr}") } Address::WebSocketIp { ip: IpAddr::V6(ip), port, } => { let addr = SocketAddr::from((ip, port)); - format!("ws://{}", addr) + format!("ws://{addr}") } // The API user of the `PlatformRef` trait is never supposed to open connections of @@ -212,15 +212,15 @@ impl PlatformRef for SubxtPlatform { } else { let _ = write!(message_build, ", "); } - let _ = write!(message_build, "{}={}", key, value); + let _ = write!(message_build, "{key}={value}"); } match log_level { - LogLevel::Error => tracing::error!("target={} {}", log_target, message_build), - LogLevel::Warn => tracing::warn!("target={} {}", log_target, message_build), - LogLevel::Info => tracing::info!("target={} {}", log_target, message_build), - LogLevel::Debug => tracing::debug!("target={} {}", log_target, message_build), - LogLevel::Trace => tracing::trace!("target={} {}", log_target, message_build), + LogLevel::Error => tracing::error!("target={log_target} {message_build}"), + LogLevel::Warn => tracing::warn!("target={log_target} {message_build}"), + LogLevel::Info => tracing::info!("target={log_target} {message_build}"), + LogLevel::Debug => tracing::debug!("target={log_target} {message_build}"), + LogLevel::Trace => tracing::trace!("target={log_target} {message_build}"), }; } } diff --git a/lightclient/src/platform/wasm_socket.rs b/lightclient/src/platform/wasm_socket.rs index 039820dd83..48ec742acf 100644 --- a/lightclient/src/platform/wasm_socket.rs +++ b/lightclient/src/platform/wasm_socket.rs @@ -78,7 +78,7 @@ impl WasmSocket { pub fn new(addr: &str) -> Result { let socket = match web_sys::WebSocket::new(addr) { Ok(socket) => socket, - Err(err) => return Err(Error::ConnectionError(format!("{:?}", err))), + Err(err) => return Err(Error::ConnectionError(format!("{err:?}"))), }; socket.set_binary_type(web_sys::BinaryType::Arraybuffer); diff --git a/metadata/src/utils/validation.rs b/metadata/src/utils/validation.rs index c0fe599772..7ad7245205 100644 --- a/metadata/src/utils/validation.rs +++ b/metadata/src/utils/validation.rs @@ -584,10 +584,11 @@ impl<'a> MetadataHasher<'a> { let extrinsic_hash = get_extrinsic_hash(&metadata.types, &metadata.extrinsic); - let custom_values_hash = self - .include_custom_values - .then(|| get_custom_metadata_hash(&metadata.custom())) - .unwrap_or_default(); + let custom_values_hash = if self.include_custom_values { + get_custom_metadata_hash(&metadata.custom()) + } else { + Default::default() + }; concat_and_hash5( &pallet_hash, diff --git a/rpcs/src/client/reconnecting_rpc_client/tests.rs b/rpcs/src/client/reconnecting_rpc_client/tests.rs index ae370a4425..fafed19f4c 100644 --- a/rpcs/src/client/reconnecting_rpc_client/tests.rs +++ b/rpcs/src/client/reconnecting_rpc_client/tests.rs @@ -243,7 +243,7 @@ async fn run_server_with_settings( drop(server_handle); }); - Ok((tx, format!("ws://{}", addr))) + Ok((tx, format!("ws://{addr}"))) } async fn serve_with_graceful_shutdown( diff --git a/subxt/examples/block_decoding_dynamic.rs b/subxt/examples/block_decoding_dynamic.rs index aa439da10e..eb45cf51b8 100644 --- a/subxt/examples/block_decoding_dynamic.rs +++ b/subxt/examples/block_decoding_dynamic.rs @@ -35,7 +35,7 @@ async fn main() -> Result<(), Box> { } } println!(" Fields:"); - println!(" {}\n", fields); + println!(" {fields}\n"); } } diff --git a/subxt/examples/blocks_subscribing.rs b/subxt/examples/blocks_subscribing.rs index 8d50b97765..05ebb69c1e 100644 --- a/subxt/examples/blocks_subscribing.rs +++ b/subxt/examples/blocks_subscribing.rs @@ -45,7 +45,7 @@ async fn main() -> Result<(), Box> { let event_values = evt.field_values()?; println!(" {pallet_name}_{event_name}"); - println!(" {}", event_values); + println!(" {event_values}"); } println!(" Transaction Extensions:"); diff --git a/subxt/examples/runtime_apis_static.rs b/subxt/examples/runtime_apis_static.rs index 65a39f54a1..95228668e6 100644 --- a/subxt/examples/runtime_apis_static.rs +++ b/subxt/examples/runtime_apis_static.rs @@ -23,6 +23,6 @@ async fn main() -> Result<(), Box> { .call(runtime_api_call) .await; - println!("AccountNonceApi_account_nonce for Alice: {:?}", nonce); + println!("AccountNonceApi_account_nonce for Alice: {nonce:?}"); Ok(()) } diff --git a/utils/fetch-metadata/src/url.rs b/utils/fetch-metadata/src/url.rs index cb513b288a..5c9ffd6136 100644 --- a/utils/fetch-metadata/src/url.rs +++ b/utils/fetch-metadata/src/url.rs @@ -35,7 +35,7 @@ impl std::str::FromStr for MetadataVersion { version => { let num: u32 = version .parse() - .map_err(|_| format!("Invalid metadata version specified {:?}", version))?; + .map_err(|_| format!("Invalid metadata version specified {version:?}"))?; Ok(MetadataVersion::Version(num)) }