Skip to content

Commit

Permalink
style: add clippy lint uninlined-format-args
Browse files Browse the repository at this point in the history
  • Loading branch information
njgheorghita committed Nov 27, 2023
1 parent dbabeec commit e09953b
Show file tree
Hide file tree
Showing 21 changed files with 26 additions and 15 deletions.
1 change: 1 addition & 0 deletions ethportal-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ethportal-api/src/types/consensus/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}")),
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion ethportal-api/src/types/content_key/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl fmt::Display for StateContentKey {
}
};

write!(f, "{}", s)
write!(f, "{s}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion ethportal-api/src/utils/serde/hex_fixed_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}")))
}
2 changes: 1 addition & 1 deletion ethportal-api/src/utils/serde/hex_var_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}")))
}
1 change: 1 addition & 0 deletions ethportal-peertest/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![warn(clippy::uninlined_format_args)]
#![cfg(unix)]
pub mod constants;
pub mod scenarios;
Expand Down
1 change: 1 addition & 0 deletions portal-bridge/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::unwrap_used)]
#![warn(clippy::uninlined_format_args)]

pub mod beacon_bridge;
pub mod bridge;
Expand Down
1 change: 1 addition & 0 deletions portalnet/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::unwrap_used)]
#![warn(clippy::uninlined_format_args)]

pub mod config;
pub mod discovery;
Expand Down
2 changes: 1 addition & 1 deletion portalnet/src/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion portalnet/src/overlay_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ where
} else if let Some(err) = err.downcast_ref::<String>() {
err.clone()
} else {
format!("{:?}", err)
format!("{err:?}")
};
debug!(err, content_key = ?content_keys_string[index], "Process uTP payload tokio task failed:");
None
Expand Down
2 changes: 1 addition & 1 deletion portalnet/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
};
Expand Down
6 changes: 3 additions & 3 deletions portalnet/src/types/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl fmt::Display for ProtocolId {
ProtocolId::Beacon => "Beacon",
ProtocolId::Utp => "uTP",
};
write!(f, "{}", protocol)
write!(f, "{protocol}")
}
}

Expand Down Expand Up @@ -389,7 +389,7 @@ impl From<Pong> 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:?}")),
}
}
}
Expand Down Expand Up @@ -434,7 +434,7 @@ impl TryFrom<NodesHelper> 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::<Result<_, _>>()?;

Expand Down
6 changes: 2 additions & 4 deletions rpc/src/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}"
))),
}
}
Expand All @@ -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:?}"
))),
}
}
Expand Down
3 changes: 2 additions & 1 deletion rpc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::unwrap_used)]
#![warn(clippy::uninlined_format_args)]

mod beacon_rpc;
mod builder;
Expand Down Expand Up @@ -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}"),
}
}

Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::unwrap_used)]
#![warn(clippy::uninlined_format_args)]

use std::sync::Arc;

Expand Down
1 change: 1 addition & 0 deletions trin-beacon/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::unwrap_used)]
#![warn(clippy::uninlined_format_args)]

pub mod events;
mod jsonrpc;
Expand Down
1 change: 1 addition & 0 deletions trin-history/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::unwrap_used)]
#![warn(clippy::uninlined_format_args)]

pub mod events;
mod jsonrpc;
Expand Down
1 change: 1 addition & 0 deletions trin-state/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::unwrap_used)]
#![warn(clippy::uninlined_format_args)]

use std::sync::Arc;

Expand Down
1 change: 1 addition & 0 deletions trin-utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::unwrap_used)]
#![warn(clippy::uninlined_format_args)]

pub mod log;
pub mod version;
1 change: 1 addition & 0 deletions trin-validation/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::unwrap_used)]
#![warn(clippy::uninlined_format_args)]

pub mod accumulator;
pub mod constants;
Expand Down
2 changes: 2 additions & 0 deletions utp-testing/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![warn(clippy::uninlined_format_args)]

extern crate core;

pub mod cli;
Expand Down

0 comments on commit e09953b

Please sign in to comment.