diff --git a/ethportal-api/src/lib.rs b/ethportal-api/src/lib.rs index 531fb9123..c2b9e74ac 100644 --- a/ethportal-api/src/lib.rs +++ b/ethportal-api/src/lib.rs @@ -2,6 +2,7 @@ //! //! `ethportal_api` is a collection of Portal Network APIs and types. #![warn(clippy::unwrap_used)] +#![warn(clippy::uninlined_format_args)] #[macro_use] extern crate lazy_static; diff --git a/ethportal-api/src/types/consensus/fork.rs b/ethportal-api/src/types/consensus/fork.rs index 800831842..f51068307 100644 --- a/ethportal-api/src/types/consensus/fork.rs +++ b/ethportal-api/src/types/consensus/fork.rs @@ -45,7 +45,7 @@ impl FromStr for ForkName { Ok(match fork_name.to_lowercase().as_ref() { "bellatrix" | "merge" => ForkName::Bellatrix, "capella" => ForkName::Capella, - _ => return Err(format!("unknown fork name: {}", fork_name)), + _ => return Err(format!("unknown fork name: {fork_name}")), }) } } diff --git a/ethportal-api/src/types/content_key/state.rs b/ethportal-api/src/types/content_key/state.rs index 4cea9db9b..346794dc8 100644 --- a/ethportal-api/src/types/content_key/state.rs +++ b/ethportal-api/src/types/content_key/state.rs @@ -140,7 +140,7 @@ impl fmt::Display for StateContentKey { } }; - write!(f, "{}", s) + write!(f, "{s}") } } diff --git a/ethportal-api/src/utils/serde/hex_fixed_vec.rs b/ethportal-api/src/utils/serde/hex_fixed_vec.rs index 2e99e7364..9d12183d4 100644 --- a/ethportal-api/src/utils/serde/hex_fixed_vec.rs +++ b/ethportal-api/src/utils/serde/hex_fixed_vec.rs @@ -19,5 +19,5 @@ where { let vec = deserializer.deserialize_string(PrefixedHexVisitor)?; FixedVector::new(vec) - .map_err(|e| serde::de::Error::custom(format!("invalid fixed vector: {:?}", e))) + .map_err(|e| serde::de::Error::custom(format!("invalid fixed vector: {e:?}"))) } diff --git a/ethportal-api/src/utils/serde/hex_var_list.rs b/ethportal-api/src/utils/serde/hex_var_list.rs index 9789506b6..5704336d8 100644 --- a/ethportal-api/src/utils/serde/hex_var_list.rs +++ b/ethportal-api/src/utils/serde/hex_var_list.rs @@ -20,5 +20,5 @@ where { let bytes = deserializer.deserialize_str(PrefixedHexVisitor)?; VariableList::new(bytes) - .map_err(|e| serde::de::Error::custom(format!("invalid variable list: {:?}", e))) + .map_err(|e| serde::de::Error::custom(format!("invalid variable list: {e:?}"))) } diff --git a/ethportal-peertest/src/lib.rs b/ethportal-peertest/src/lib.rs index 58b8ce9ea..f5a5021aa 100644 --- a/ethportal-peertest/src/lib.rs +++ b/ethportal-peertest/src/lib.rs @@ -1,3 +1,4 @@ +#![warn(clippy::uninlined_format_args)] #![cfg(unix)] pub mod constants; pub mod scenarios; diff --git a/portal-bridge/src/lib.rs b/portal-bridge/src/lib.rs index e12309c01..145d10eab 100644 --- a/portal-bridge/src/lib.rs +++ b/portal-bridge/src/lib.rs @@ -1,4 +1,5 @@ #![warn(clippy::unwrap_used)] +#![warn(clippy::uninlined_format_args)] pub mod beacon_bridge; pub mod bridge; diff --git a/portalnet/src/lib.rs b/portalnet/src/lib.rs index d04073aa8..8206f3f10 100644 --- a/portalnet/src/lib.rs +++ b/portalnet/src/lib.rs @@ -1,4 +1,5 @@ #![warn(clippy::unwrap_used)] +#![warn(clippy::uninlined_format_args)] pub mod config; pub mod discovery; diff --git a/portalnet/src/overlay.rs b/portalnet/src/overlay.rs index 3a56fe178..dc1791ef6 100644 --- a/portalnet/src/overlay.rs +++ b/portalnet/src/overlay.rs @@ -552,7 +552,7 @@ where stream .read_to_eof(&mut data) .await - .map_err(|err| OverlayRequestError::UtpError(format!("{:?}", err)))?; + .map_err(|err| OverlayRequestError::UtpError(format!("{err:?}")))?; Ok(data) } diff --git a/portalnet/src/overlay_service.rs b/portalnet/src/overlay_service.rs index 4045eb298..b7f3ac224 100644 --- a/portalnet/src/overlay_service.rs +++ b/portalnet/src/overlay_service.rs @@ -1758,7 +1758,7 @@ where } else if let Some(err) = err.downcast_ref::() { err.clone() } else { - format!("{:?}", err) + format!("{err:?}") }; debug!(err, content_key = ?content_keys_string[index], "Process uTP payload tokio task failed:"); None diff --git a/portalnet/src/storage.rs b/portalnet/src/storage.rs index 9518da3b7..82f87ccf8 100644 --- a/portalnet/src/storage.rs +++ b/portalnet/src/storage.rs @@ -660,7 +660,7 @@ impl PortalStorage { ), // Received data of size other than 32 bytes. length => { - let err = format!("content ID of length {} != 32", length); + let err = format!("content ID of length {length} != 32"); return Err(ContentStoreError::InvalidData { message: err }); } }; diff --git a/portalnet/src/types/messages.rs b/portalnet/src/types/messages.rs index a748e8232..6bef3885d 100644 --- a/portalnet/src/types/messages.rs +++ b/portalnet/src/types/messages.rs @@ -198,7 +198,7 @@ impl fmt::Display for ProtocolId { ProtocolId::Beacon => "Beacon", ProtocolId::Utp => "uTP", }; - write!(f, "{}", protocol) + write!(f, "{protocol}") } } @@ -389,7 +389,7 @@ impl From for Value { Value::Object(result) } - Err(msg) => Value::String(format!("Unable to ssz decode data radius!: {:?}", msg)), + Err(msg) => Value::String(format!("Unable to ssz decode data radius!: {msg:?}")), } } } @@ -434,7 +434,7 @@ impl TryFrom for Nodes { .into_iter() .map(|bytes| { rlp::decode(&bytes) - .map_err(|e| DecodeError::BytesInvalid(format!("rlp decoding failed: {}", e))) + .map_err(|e| DecodeError::BytesInvalid(format!("rlp decoding failed: {e}"))) }) .collect::>()?; diff --git a/rpc/src/fetch.rs b/rpc/src/fetch.rs index 30ff0d283..ca4a28e6e 100644 --- a/rpc/src/fetch.rs +++ b/rpc/src/fetch.rs @@ -46,8 +46,7 @@ pub async fn find_header_by_hash( match header { HistoryContentValue::BlockHeaderWithProof(h) => Ok(h.header), wrong_val => Err(RpcServeError::Message(format!( - "Internal trin error: got back a non-header from a key that must only point to headers; got {:?}", - wrong_val + "Internal trin error: got back a non-header from a key that must only point to headers; got {wrong_val:?}" ))), } } @@ -63,8 +62,7 @@ pub async fn find_block_body_by_hash( match body { HistoryContentValue::BlockBody(body) => Ok(body), wrong_val => Err(RpcServeError::Message(format!( - "Internal trin error: got back a non-body from a key that must only point to bodies; got {:?}", - wrong_val + "Internal trin error: got back a non-body from a key that must only point to bodies; got {wrong_val:?}" ))), } } diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 5df4c7af8..b3ab5a327 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -1,4 +1,5 @@ #![warn(clippy::unwrap_used)] +#![warn(clippy::uninlined_format_args)] mod beacon_rpc; mod builder; @@ -56,7 +57,7 @@ pub async fn launch_jsonrpc_server( // not implemented } BEACON_NETWORK => modules.push(PortalRpcModule::Beacon), - _ => panic!("Unexpected network type: {}", network), + _ => panic!("Unexpected network type: {network}"), } } diff --git a/src/lib.rs b/src/lib.rs index 70b3dff44..20378c78b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ #![warn(clippy::unwrap_used)] +#![warn(clippy::uninlined_format_args)] use std::sync::Arc; diff --git a/trin-beacon/src/lib.rs b/trin-beacon/src/lib.rs index 1af607039..d523ca1ad 100644 --- a/trin-beacon/src/lib.rs +++ b/trin-beacon/src/lib.rs @@ -1,4 +1,5 @@ #![warn(clippy::unwrap_used)] +#![warn(clippy::uninlined_format_args)] pub mod events; mod jsonrpc; diff --git a/trin-history/src/lib.rs b/trin-history/src/lib.rs index 9ef790361..4263fd299 100644 --- a/trin-history/src/lib.rs +++ b/trin-history/src/lib.rs @@ -1,4 +1,5 @@ #![warn(clippy::unwrap_used)] +#![warn(clippy::uninlined_format_args)] pub mod events; mod jsonrpc; diff --git a/trin-state/src/lib.rs b/trin-state/src/lib.rs index d1b026ee7..dddd13577 100644 --- a/trin-state/src/lib.rs +++ b/trin-state/src/lib.rs @@ -1,4 +1,5 @@ #![warn(clippy::unwrap_used)] +#![warn(clippy::uninlined_format_args)] use std::sync::Arc; diff --git a/trin-utils/src/lib.rs b/trin-utils/src/lib.rs index 6ef0b4550..ec071f1d4 100644 --- a/trin-utils/src/lib.rs +++ b/trin-utils/src/lib.rs @@ -1,4 +1,5 @@ #![warn(clippy::unwrap_used)] +#![warn(clippy::uninlined_format_args)] pub mod log; pub mod version; diff --git a/trin-validation/src/lib.rs b/trin-validation/src/lib.rs index be005ae01..d41a28224 100644 --- a/trin-validation/src/lib.rs +++ b/trin-validation/src/lib.rs @@ -1,4 +1,5 @@ #![warn(clippy::unwrap_used)] +#![warn(clippy::uninlined_format_args)] pub mod accumulator; pub mod constants; diff --git a/utp-testing/src/lib.rs b/utp-testing/src/lib.rs index 951d38f02..6ba467b1e 100644 --- a/utp-testing/src/lib.rs +++ b/utp-testing/src/lib.rs @@ -1,3 +1,5 @@ +#![warn(clippy::uninlined_format_args)] + extern crate core; pub mod cli;