From 74ec1d5298b7dc2aa39864b8962a82e05f845533 Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Fri, 18 Feb 2022 17:55:29 +0200 Subject: [PATCH] chore: remove unused vars --- cli/tests/cmd.rs | 2 +- utils/src/lib.rs | 65 ++++++++++++++++++++++++++++++++---------------- 2 files changed, 44 insertions(+), 23 deletions(-) diff --git a/cli/tests/cmd.rs b/cli/tests/cmd.rs index f2a1a397e1500..ec8c1cfe70ba8 100644 --- a/cli/tests/cmd.rs +++ b/cli/tests/cmd.rs @@ -259,7 +259,7 @@ forgetest_init!(can_emit_extra_output, |prj: TestProject, mut cmd: TestCommand| cmd.assert_non_empty_stdout(); let metadata_path = prj.paths().artifacts.join("Contract.sol/Contract.metadata.json"); - let artifact: Metadata = ethers::solc::utils::read_json_file(metadata_path).unwrap(); + let _artifact: Metadata = ethers::solc::utils::read_json_file(metadata_path).unwrap(); }); // test against a local checkout, useful to debug with local ethers-rs patch diff --git a/utils/src/lib.rs b/utils/src/lib.rs index 662f4d5971f73..c7195d99fe194 100644 --- a/utils/src/lib.rs +++ b/utils/src/lib.rs @@ -920,11 +920,8 @@ mod tests { use super::*; use ethers::{ abi::Abi, + solc::{artifacts::CompactContractBytecode, Project, ProjectPathsConfig}, types::{Address, Bytes}, - solc::{ - ProjectPathsConfig, Project, Artifact, - artifacts::CompactContractBytecode, - } }; use std::path::PathBuf; @@ -932,17 +929,18 @@ mod tests { fn test_linking() { let lib_test_json_lib_test = "6101d1610053600b82828239805160001a607314610046577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100355760003560e01c806314ba3f121461003a575b600080fd5b610054600480360381019061004f91906100bb565b61006a565b60405161006191906100f7565b60405180910390f35b60006064826100799190610141565b9050919050565b600080fd5b6000819050919050565b61009881610085565b81146100a357600080fd5b50565b6000813590506100b58161008f565b92915050565b6000602082840312156100d1576100d0610080565b5b60006100df848285016100a6565b91505092915050565b6100f181610085565b82525050565b600060208201905061010c60008301846100e8565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061014c82610085565b915061015783610085565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156101905761018f610112565b5b82820290509291505056fea264697066735822122089bbb5614fb9e62f207b40682b397b25f2000c514857bf7959055b0d9b5dcfbf64736f6c634300080b0033"; let lib_test_nested_json_lib_test_nested = "610266610053600b82828239805160001a607314610046577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100355760003560e01c80639acc23361461003a575b600080fd5b610054600480360381019061004f9190610116565b61006a565b604051610061919061015c565b60405180910390f35b60007347e9fbef8c83a1714f1951f142132e6e90f5fa5d6314ba3f1260656040518263ffffffff1660e01b81526004016100a491906101bc565b602060405180830381865af41580156100c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e59190610203565b9050919050565b600080fd5b600381106100fe57600080fd5b50565b600081359050610110816100f1565b92915050565b60006020828403121561012c5761012b6100ec565b5b600061013a84828501610101565b91505092915050565b6000819050919050565b61015681610143565b82525050565b6000602082019050610171600083018461014d565b92915050565b6000819050919050565b6000819050919050565b60006101a66101a161019c84610177565b610181565b610143565b9050919050565b6101b68161018b565b82525050565b60006020820190506101d160008301846101ad565b92915050565b6101e081610143565b81146101eb57600080fd5b50565b6000815190506101fd816101d7565b92915050565b600060208284031215610219576102186100ec565b5b6000610227848285016101ee565b9150509291505056fea26469706673582212204d96467c5d42f97ecaa460cca5137364d61ae850ee0be7c2d9c5ffb045bf8dc364736f6c634300080b0033"; - let contract_names = ["DsTestMini.json:DsTestMini", "LibLinkingTest.json:LibLinkingTest", "LibTest.json:LibTest", "LibTestNested.json:LibTestNested", "Main.json:Main"]; + let contract_names = [ + "DsTestMini.json:DsTestMini", + "LibLinkingTest.json:LibLinkingTest", + "LibTest.json:LibTest", + "LibTestNested.json:LibTestNested", + "Main.json:Main", + ]; let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("testdata/linking"); let paths = ProjectPathsConfig::builder().root(&root).sources(&root).build().unwrap(); - let project = Project::builder() - .paths(paths) - .ephemeral() - .no_artifacts() - .build() - .unwrap(); + let project = Project::builder().paths(paths).ephemeral().no_artifacts().build().unwrap(); let output = project.compile().unwrap(); let contracts = output @@ -951,7 +949,8 @@ mod tests { .collect::>(); let mut known_contracts: BTreeMap)> = Default::default(); - let mut deployable_contracts: BTreeMap)> = Default::default(); + let mut deployable_contracts: BTreeMap)> = + Default::default(); assert_eq!(&contracts.keys().collect::>()[..], &contract_names[..]); @@ -968,28 +967,50 @@ mod tests { } "LibLinkingTest.json:LibLinkingTest" => { assert_eq!(post_link_input.dependencies.len(), 3); - assert_eq!(hex::encode(post_link_input.dependencies[0].clone()), lib_test_json_lib_test); - assert_eq!(hex::encode(post_link_input.dependencies[1].clone()), lib_test_json_lib_test); - assert_eq!(hex::encode(post_link_input.dependencies[2].clone()), lib_test_nested_json_lib_test_nested); + assert_eq!( + hex::encode(post_link_input.dependencies[0].clone()), + lib_test_json_lib_test + ); + assert_eq!( + hex::encode(post_link_input.dependencies[1].clone()), + lib_test_json_lib_test + ); + assert_eq!( + hex::encode(post_link_input.dependencies[2].clone()), + lib_test_nested_json_lib_test_nested + ); } "LibTest.json:LibTest" => { assert_eq!(post_link_input.dependencies.len(), 0); } "LibTestNested.json:LibTestNested" => { assert_eq!(post_link_input.dependencies.len(), 1); - assert_eq!(hex::encode(post_link_input.dependencies[0].clone()), lib_test_json_lib_test); + assert_eq!( + hex::encode(post_link_input.dependencies[0].clone()), + lib_test_json_lib_test + ); } "Main.json:Main" => { assert_eq!(post_link_input.dependencies.len(), 3); - assert_eq!(hex::encode(post_link_input.dependencies[0].clone()), lib_test_json_lib_test); - assert_eq!(hex::encode(post_link_input.dependencies[1].clone()), lib_test_json_lib_test); - assert_eq!(hex::encode(post_link_input.dependencies[2].clone()), lib_test_nested_json_lib_test_nested); + assert_eq!( + hex::encode(post_link_input.dependencies[0].clone()), + lib_test_json_lib_test + ); + assert_eq!( + hex::encode(post_link_input.dependencies[1].clone()), + lib_test_json_lib_test + ); + assert_eq!( + hex::encode(post_link_input.dependencies[2].clone()), + lib_test_nested_json_lib_test_nested + ); } - _ => assert!(false) + _ => assert!(false), } Ok(()) - } - ).unwrap(); + }, + ) + .unwrap(); } #[test]