Make unstable clippy happy with clippy --fix (#402)

Most of changes either move variables into `format!` templates
or remove excessive clones.
This commit is contained in:
Ivan Boldyrev
2022-12-12 22:37:05 +07:00
committed by GitHub
parent e5837e9171
commit 004ce10abd
62 changed files with 256 additions and 302 deletions

View File

@@ -103,13 +103,13 @@ impl std::fmt::Display for ExecutedState {
Par(ParResult {
left_size: left_subgraph_size,
right_size: right_subgraph_size,
}) => write!(f, "par({}, {})", left_subgraph_size, right_subgraph_size),
Call(RequestSentBy(sender)) => write!(f, r"{}", sender),
}) => write!(f, "par({left_subgraph_size}, {right_subgraph_size})"),
Call(RequestSentBy(sender)) => write!(f, r"{sender}"),
Call(Executed(value)) => {
write!(f, "executed({})", value)
write!(f, "executed({value})")
}
Call(CallServiceFailed(ret_code, err_msg)) => {
write!(f, r#"call_service_failed({}, "{}")"#, ret_code, err_msg)
write!(f, r#"call_service_failed({ret_code}, "{err_msg}")"#)
}
Fold(FoldResult { lore }) => {
writeln!(f, "fold(",)?;
@@ -139,9 +139,9 @@ impl std::fmt::Display for ExecutedState {
impl std::fmt::Display for Value {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Value::Scalar(value) => write!(f, "scalar: {}", value),
Value::Scalar(value) => write!(f, "scalar: {value}"),
Value::Stream { value, generation } => {
write!(f, "stream: {} generation: {}", value, generation)
write!(f, "stream: {value} generation: {generation}")
}
}
}
@@ -150,9 +150,9 @@ impl std::fmt::Display for Value {
impl std::fmt::Display for Sender {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Sender::PeerId(peer_id) => write!(f, "request_sent_by({})", peer_id),
Sender::PeerId(peer_id) => write!(f, "request_sent_by({peer_id})"),
Sender::PeerIdWithCallId { peer_id, call_id } => {
write!(f, "request_sent_by({}: {})", peer_id, call_id)
write!(f, "request_sent_by({peer_id}: {call_id})")
}
}
}

View File

@@ -77,7 +77,7 @@ pub mod sender_serializer {
match value {
Sender::PeerId(peer_id) => serializer.serialize_str(peer_id.as_str()),
Sender::PeerIdWithCallId { peer_id, call_id } => {
let result = format!("{}: {}", peer_id, call_id);
let result = format!("{peer_id}: {call_id}");
serializer.serialize_str(&result)
}
}
@@ -103,8 +103,7 @@ pub mod sender_serializer {
let call_id = &raw_sender[pos + 2..];
let call_id = call_id.parse::<u32>().map_err(|e| {
serde::de::Error::custom(format!(
"failed to parse call_id of a sender {}: {}",
call_id, e
"failed to parse call_id of a sender {call_id}: {e}"
))
})?;
Sender::PeerIdWithCallId {