Skip to content

Commit

Permalink
chore: apply suggestions from beta clippy (#3251)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaseizinger authored Dec 17, 2022
1 parent 56398cb commit 8c139f2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions core/src/upgrade/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ impl<N: ProtocolName> fmt::Display for DisplayProtocolName<N> {
if (b' '..=b'~').contains(byte) {
f.write_char(char::from(*byte))?;
} else {
write!(f, "<{:02X}>", byte)?;
write!(f, "<{byte:02X}>")?;
}
}
Ok(())
Expand All @@ -302,9 +302,9 @@ mod tests {
assert_eq!(
DisplayProtocolName((0u8..=255).collect::<Vec<_>>()).to_string(),
(0..32)
.map(|c| format!("<{:02X}>", c))
.map(|c| format!("<{c:02X}>"))
.chain((32..127).map(|c| format!("{}", char::from_u32(c).unwrap())))
.chain((127..256).map(|c| format!("<{:02X}>", c)))
.chain((127..256).map(|c| format!("<{c:02X}>")))
.collect::<String>()
);
}
Expand Down
4 changes: 2 additions & 2 deletions protocols/gossipsub/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3678,10 +3678,10 @@ impl fmt::Debug for PublishConfig {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
PublishConfig::Signing { author, .. } => {
f.write_fmt(format_args!("PublishConfig::Signing({})", author))
f.write_fmt(format_args!("PublishConfig::Signing({author})"))
}
PublishConfig::Author(author) => {
f.write_fmt(format_args!("PublishConfig::Author({})", author))
f.write_fmt(format_args!("PublishConfig::Author({author})"))
}
PublishConfig::RandomAuthor => f.write_fmt(format_args!("PublishConfig::RandomAuthor")),
PublishConfig::Anonymous => f.write_fmt(format_args!("PublishConfig::Anonymous")),
Expand Down
16 changes: 7 additions & 9 deletions swarm/tests/swarm_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,21 +256,19 @@ fn custom_event_emit_event_through_poll() {
}

#[allow(dead_code, unreachable_code, clippy::diverging_sub_expression)]
fn bar() {
async fn bar() {
require_net_behaviour::<Foo>();

let mut _swarm: libp2p_swarm::Swarm<Foo> = unimplemented!();

// check that the event is bubbled up all the way to swarm
let _ = async {
loop {
match _swarm.select_next_some().await {
SwarmEvent::Behaviour(BehaviourOutEvent::Ping(_)) => break,
SwarmEvent::Behaviour(BehaviourOutEvent::Identify(_)) => break,
_ => {}
}
loop {
match _swarm.select_next_some().await {
SwarmEvent::Behaviour(BehaviourOutEvent::Ping(_)) => break,
SwarmEvent::Behaviour(BehaviourOutEvent::Identify(_)) => break,
_ => {}
}
};
}
}
}

Expand Down

0 comments on commit 8c139f2

Please sign in to comment.