*: Fix newly raised clippy warnings (#3106)

Fixed minor issues raised by clippy to improve correctness and readablitity.
This commit is contained in:
Hannes
2022-11-11 21:30:58 +01:00
committed by GitHub
parent 90df86d9e7
commit c32f03c317
20 changed files with 51 additions and 53 deletions

View File

@ -131,7 +131,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
env_logger::init();
let ipfs_path = get_ipfs_path();
println!("using IPFS_PATH {:?}", ipfs_path);
println!("using IPFS_PATH {ipfs_path:?}");
let psk: Option<PreSharedKey> = get_psk(&ipfs_path)?
.map(|text| PreSharedKey::from_str(&text))
.transpose()?;
@ -139,7 +139,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
// Create a random PeerId
let local_key = identity::Keypair::generate_ed25519();
let local_peer_id = PeerId::from(local_key.public());
println!("using random peer id: {:?}", local_peer_id);
println!("using random peer id: {local_peer_id:?}");
if let Some(psk) = psk {
println!("using swarm key with fingerprint: {}", psk.fingerprint());
}
@ -202,7 +202,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
ping: ping::Behaviour::new(ping::Config::new()),
};
println!("Subscribing to {:?}", gossipsub_topic);
println!("Subscribing to {gossipsub_topic:?}");
behaviour.gossipsub.subscribe(&gossipsub_topic).unwrap();
Swarm::new(transport, behaviour, local_peer_id)
};
@ -211,7 +211,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
for to_dial in std::env::args().skip(1) {
let addr: Multiaddr = parse_legacy_multiaddr(&to_dial)?;
swarm.dial(addr)?;
println!("Dialed {:?}", to_dial)
println!("Dialed {to_dial:?}")
}
// Read full lines from stdin
@ -229,16 +229,16 @@ async fn main() -> Result<(), Box<dyn Error>> {
.gossipsub
.publish(gossipsub_topic.clone(), line.expect("Stdin not to close").as_bytes())
{
println!("Publish error: {:?}", e);
println!("Publish error: {e:?}");
}
},
event = swarm.select_next_some() => {
match event {
SwarmEvent::NewListenAddr { address, .. } => {
println!("Listening on {:?}", address);
println!("Listening on {address:?}");
}
SwarmEvent::Behaviour(MyBehaviourEvent::Identify(event)) => {
println!("identify: {:?}", event);
println!("identify: {event:?}");
}
SwarmEvent::Behaviour(MyBehaviourEvent::Gossipsub(GossipsubEvent::Message {
propagation_source: peer_id,
@ -286,7 +286,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
peer,
result: Result::Err(ping::Failure::Other { error }),
} => {
println!("ping: ping::Failure with {}: {}", peer.to_base58(), error);
println!("ping: ping::Failure with {}: {error}", peer.to_base58());
}
}
}