Cargo clippy: fix the majority of errors
This commit is contained in:
parent
871d927596
commit
6968a4e449
19 changed files with 69 additions and 91 deletions
|
|
@ -509,7 +509,7 @@ mod tests {
|
|||
const WHAT_IS_THAT: &[u8]= b"64313a6164323a696432303abd7b477cfbcd10f30b705da20201e7101d8df155393a696e666f5f6861736832303acab507494d02ebb1178b38f2e9d7be299c86b86265313a71393a6765745f7065657273313a74323a0007313a79313a7165";
|
||||
|
||||
fn write(filename: &str, data: &[u8]) {
|
||||
let full = format!("/tmp/{}.bin", filename);
|
||||
let full = format!("/tmp/{filename}.bin");
|
||||
let mut f = std::fs::OpenOptions::new()
|
||||
.create(true)
|
||||
.write(true)
|
||||
|
|
@ -519,7 +519,7 @@ mod tests {
|
|||
}
|
||||
|
||||
fn debug_hex_bencode(name: &str, data: &[u8]) {
|
||||
println!("{}", name);
|
||||
println!("{name}");
|
||||
let data = hex::decode(data).unwrap();
|
||||
|
||||
println!(
|
||||
|
|
@ -544,8 +544,8 @@ mod tests {
|
|||
bprotocol::serialize_message(&mut buf, transaction_id, version, ip, kind).unwrap();
|
||||
|
||||
if buf.as_slice() != data {
|
||||
write(&format!("{}-serialized", name), buf.as_slice());
|
||||
write(&format!("{}-expected", name), data);
|
||||
write(&format!("{name}-serialized"), buf.as_slice());
|
||||
write(&format!("{name}-expected"), data);
|
||||
panic!(
|
||||
"{} results don't match, dumped to /tmp/{}-*.bin",
|
||||
name, name
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ fn dump_dht(dht: &Dht, filename: &Path, tempfile_name: &Path) -> anyhow::Result<
|
|||
.truncate(true)
|
||||
.create(true)
|
||||
.write(true)
|
||||
.open(&tempfile_name)
|
||||
.with_context(|| format!("error opening {:?}", tempfile_name))?;
|
||||
.open(tempfile_name)
|
||||
.with_context(|| format!("error opening {tempfile_name:?}"))?;
|
||||
|
||||
let addr = dht.listen_addr();
|
||||
match dht
|
||||
|
|
@ -46,13 +46,13 @@ fn dump_dht(dht: &Dht, filename: &Path, tempfile_name: &Path) -> anyhow::Result<
|
|||
}
|
||||
Err(e) => {
|
||||
return Err(e).with_context(|| {
|
||||
format!("error serializing DHT routing table to {:?}", tempfile_name)
|
||||
format!("error serializing DHT routing table to {tempfile_name:?}")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
std::fs::rename(tempfile_name, filename)
|
||||
.with_context(|| format!("error renaming {:?} to {:?}", tempfile_name, filename))
|
||||
.with_context(|| format!("error renaming {tempfile_name:?} to {filename:?}"))
|
||||
}
|
||||
|
||||
impl PersistentDht {
|
||||
|
|
@ -92,7 +92,7 @@ impl PersistentDht {
|
|||
}
|
||||
Err(e) => match e.kind() {
|
||||
std::io::ErrorKind::NotFound => None,
|
||||
_ => return Err(e).with_context(|| format!("error reading {:?}", config_filename)),
|
||||
_ => return Err(e).with_context(|| format!("error reading {config_filename:?}")),
|
||||
},
|
||||
};
|
||||
let (listen_addr, routing_table) = de
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue