Further expand clippy workspace lints

Achieves a notable amount of reduced async and clones.
This commit is contained in:
Luke Parker
2023-12-17 00:01:41 -05:00
parent ea3af28139
commit 065d314e2a
113 changed files with 596 additions and 724 deletions

View File

@@ -307,12 +307,11 @@ impl Processor {
block_number,
},
) => {
let block = match id {
SubstrateSignId {
id: SubstrateSignableId::CosigningSubstrateBlock(block),
..
} => block,
_ => panic!("CosignSubstrateBlock didn't have CosigningSubstrateBlock ID"),
let SubstrateSignId {
id: SubstrateSignableId::CosigningSubstrateBlock(block), ..
} = id
else {
panic!("CosignSubstrateBlock didn't have CosigningSubstrateBlock ID")
};
let new_cosign = CurrentCosign { block_number, block };

View File

@@ -99,7 +99,7 @@ pub async fn batch(
participants.insert(known_signer_i);
participants
}
other => panic!("coordinator didn't send back SubstratePreprocesses: {:?}", other),
other => panic!("coordinator didn't send back SubstratePreprocesses: {other:?}"),
};
for i in participants.clone() {

View File

@@ -70,8 +70,7 @@ pub fn build(name: String) {
// Check any additionally specified paths
let meta = |path: PathBuf| (path.clone(), fs::metadata(path));
let mut metadatas = match name.as_str() {
"bitcoin" => vec![],
"monero" => vec![],
"bitcoin" | "monero" => vec![],
"message-queue" => vec![
meta(repo_path.join("common")),
meta(repo_path.join("crypto")),
@@ -94,12 +93,7 @@ pub fn build(name: String) {
meta(repo_path.join("message-queue")),
meta(repo_path.join("coordinator")),
],
"runtime" => vec![
meta(repo_path.join("common")),
meta(repo_path.join("crypto")),
meta(repo_path.join("substrate")),
],
"serai" => vec![
"runtime" | "serai" => vec![
meta(repo_path.join("common")),
meta(repo_path.join("crypto")),
meta(repo_path.join("substrate")),
@@ -132,7 +126,7 @@ pub fn build(name: String) {
if let Some(last_modified) = last_modified {
if last_modified < created_time {
println!("{} was built after the most recent source code edits, assuming built.", name);
println!("{name} was built after the most recent source code edits, assuming built.");
built_lock.insert(name, true);
return;
}

View File

@@ -395,7 +395,7 @@ async fn mint_and_burn_test() {
),
1_100_000_000_000,
)],
Change::new(&view_pair, false),
&Change::new(&view_pair, false),
vec![Shorthand::transfer(None, serai_addr).encode()],
rpc.get_fee(Protocol::v16, FeePriority::Low).await.unwrap(),
)

View File

@@ -314,7 +314,7 @@ impl Coordinator {
let res: Option<String> =
rpc.rpc_call("submitblock", serde_json::json!([hex::encode(block)])).await.unwrap();
if let Some(err) = res {
panic!("submitblock failed: {}", err);
panic!("submitblock failed: {err}");
}
}
NetworkId::Ethereum => todo!(),

View File

@@ -361,7 +361,7 @@ impl Wallet {
None,
these_inputs.drain(..).zip(decoys.drain(..)).collect(),
vec![(to_addr, AMOUNT)],
Change::new(view_pair, false),
&Change::new(view_pair, false),
data,
rpc.get_fee(Protocol::v16, FeePriority::Low).await.unwrap(),
)

View File

@@ -96,6 +96,6 @@ pub fn reproducibly_builds() {
for res in res.clone() {
identical.insert(res.unwrap());
}
assert_eq!(identical.len(), 1, "got different runtime hashes {:?}", res);
assert_eq!(identical.len(), 1, "got different runtime hashes {res:?}");
});
}