mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-22 22:31:33 +00:00
chore: apply suggestions from beta clippy (#3251)
This commit is contained in:
@ -284,7 +284,7 @@ impl<N: ProtocolName> fmt::Display for DisplayProtocolName<N> {
|
|||||||
if (b' '..=b'~').contains(byte) {
|
if (b' '..=b'~').contains(byte) {
|
||||||
f.write_char(char::from(*byte))?;
|
f.write_char(char::from(*byte))?;
|
||||||
} else {
|
} else {
|
||||||
write!(f, "<{:02X}>", byte)?;
|
write!(f, "<{byte:02X}>")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -302,9 +302,9 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
DisplayProtocolName((0u8..=255).collect::<Vec<_>>()).to_string(),
|
DisplayProtocolName((0u8..=255).collect::<Vec<_>>()).to_string(),
|
||||||
(0..32)
|
(0..32)
|
||||||
.map(|c| format!("<{:02X}>", c))
|
.map(|c| format!("<{c:02X}>"))
|
||||||
.chain((32..127).map(|c| format!("{}", char::from_u32(c).unwrap())))
|
.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>()
|
.collect::<String>()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3678,10 +3678,10 @@ impl fmt::Debug for PublishConfig {
|
|||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
PublishConfig::Signing { author, .. } => {
|
PublishConfig::Signing { author, .. } => {
|
||||||
f.write_fmt(format_args!("PublishConfig::Signing({})", author))
|
f.write_fmt(format_args!("PublishConfig::Signing({author})"))
|
||||||
}
|
}
|
||||||
PublishConfig::Author(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::RandomAuthor => f.write_fmt(format_args!("PublishConfig::RandomAuthor")),
|
||||||
PublishConfig::Anonymous => f.write_fmt(format_args!("PublishConfig::Anonymous")),
|
PublishConfig::Anonymous => f.write_fmt(format_args!("PublishConfig::Anonymous")),
|
||||||
|
@ -256,21 +256,19 @@ fn custom_event_emit_event_through_poll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code, unreachable_code, clippy::diverging_sub_expression)]
|
#[allow(dead_code, unreachable_code, clippy::diverging_sub_expression)]
|
||||||
fn bar() {
|
async fn bar() {
|
||||||
require_net_behaviour::<Foo>();
|
require_net_behaviour::<Foo>();
|
||||||
|
|
||||||
let mut _swarm: libp2p_swarm::Swarm<Foo> = unimplemented!();
|
let mut _swarm: libp2p_swarm::Swarm<Foo> = unimplemented!();
|
||||||
|
|
||||||
// check that the event is bubbled up all the way to swarm
|
// check that the event is bubbled up all the way to swarm
|
||||||
let _ = async {
|
loop {
|
||||||
loop {
|
match _swarm.select_next_some().await {
|
||||||
match _swarm.select_next_some().await {
|
SwarmEvent::Behaviour(BehaviourOutEvent::Ping(_)) => break,
|
||||||
SwarmEvent::Behaviour(BehaviourOutEvent::Ping(_)) => break,
|
SwarmEvent::Behaviour(BehaviourOutEvent::Identify(_)) => break,
|
||||||
SwarmEvent::Behaviour(BehaviourOutEvent::Identify(_)) => break,
|
_ => {}
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user