chore: Implement latest clippy warnings (#3220)

As I do frequently, I corrected for the latest clippy warnings. This will make sure the CI won't complain in the future. We could automate this btw and maybe run the nightly version of clippy.
This commit is contained in:
Hannes
2022-12-14 16:45:04 +01:00
committed by GitHub
parent be3ec6c62b
commit d79c93abdb
72 changed files with 244 additions and 307 deletions

View File

@ -47,7 +47,7 @@ use std::error::Error;
async fn main() -> Result<(), Box<dyn Error>> {
let local_key = identity::Keypair::generate_ed25519();
let local_peer_id = PeerId::from(local_key.public());
println!("Local peer id: {:?}", local_peer_id);
println!("Local peer id: {local_peer_id:?}");
let transport = libp2p_tcp::async_io::Transport::default()
.upgrade(Version::V1)
@ -72,19 +72,19 @@ async fn main() -> Result<(), Box<dyn Error>> {
if let Some(addr) = std::env::args().nth(1) {
let remote: Multiaddr = addr.parse()?;
swarm.dial(remote)?;
println!("Dialed {}", addr)
println!("Dialed {addr}")
}
loop {
match swarm.select_next_some().await {
SwarmEvent::NewListenAddr { address, .. } => println!("Listening on {:?}", address),
SwarmEvent::NewListenAddr { address, .. } => println!("Listening on {address:?}"),
// Prints peer id identify info is being sent to.
SwarmEvent::Behaviour(identify::Event::Sent { peer_id, .. }) => {
println!("Sent identify info to {:?}", peer_id)
println!("Sent identify info to {peer_id:?}")
}
// Prints out the info received via the identify event
SwarmEvent::Behaviour(identify::Event::Received { info, .. }) => {
println!("Received {:?}", info)
println!("Received {info:?}")
}
_ => {}
}