diff --git a/light-client/src/components/verifier.rs b/light-client/src/components/verifier.rs index fb37b1c81..21249ddf5 100644 --- a/light-client/src/components/verifier.rs +++ b/light-client/src/components/verifier.rs @@ -113,8 +113,8 @@ impl Verifier for ProdVerifier { &*self.voting_power_calculator, &*self.commit_validator, &*self.hasher, - &trusted, - &untrusted, + trusted, + untrusted, options, now, ) diff --git a/light-client/src/evidence.rs b/light-client/src/evidence.rs index 2bfd7c411..83c02108a 100644 --- a/light-client/src/evidence.rs +++ b/light-client/src/evidence.rs @@ -70,7 +70,7 @@ mod prod { #[pre(self.peer_map.contains_key(&peer))] fn rpc_client_for(&self, peer: PeerId) -> Result { let peer_addr = self.peer_map.get(&peer).unwrap().to_owned(); - Ok(rpc::HttpClient::new(peer_addr).map_err(IoError::from)?) + rpc::HttpClient::new(peer_addr).map_err(IoError::from) } } } diff --git a/light-client/src/macros.rs b/light-client/src/macros.rs index a5d5aa94f..284ebe651 100644 --- a/light-client/src/macros.rs +++ b/light-client/src/macros.rs @@ -4,7 +4,7 @@ #[macro_export] macro_rules! bail { ($kind:expr) => { - return Err($kind.into()); + return Err($kind.into()) }; } diff --git a/light-client/src/peer_list.rs b/light-client/src/peer_list.rs index 20e740ab7..dbd1c6fa5 100644 --- a/light-client/src/peer_list.rs +++ b/light-client/src/peer_list.rs @@ -115,7 +115,7 @@ impl PeerList { /// - The given peer id must not be the primary peer id. /// - The given peer must be in the witness list #[pre(faulty_witness != self.primary && self.witnesses.contains(&faulty_witness))] - #[post(Self::invariant(&self))] + #[post(Self::invariant(self))] pub fn replace_faulty_witness(&mut self, faulty_witness: PeerId) -> Option { let mut result = None; @@ -137,7 +137,7 @@ impl PeerList { /// /// ## Errors /// - If there are no witness left, returns `ErrorKind::NoWitnessLeft`. - #[post(ret.is_ok() ==> Self::invariant(&self))] + #[post(ret.is_ok() ==> Self::invariant(self))] pub fn replace_faulty_primary( &mut self, primary_error: Option, diff --git a/light-client/src/predicates.rs b/light-client/src/predicates.rs index a4794968e..89057b7c7 100644 --- a/light-client/src/predicates.rs +++ b/light-client/src/predicates.rs @@ -240,10 +240,10 @@ pub fn verify( vp.is_header_from_past(&untrusted.signed_header.header, options.clock_drift, now)?; // Ensure the header validator hashes match the given validators - vp.validator_sets_match(&untrusted, &*hasher)?; + vp.validator_sets_match(untrusted, &*hasher)?; // Ensure the header next validator hashes match the given next validators - vp.next_validators_match(&untrusted, &*hasher)?; + vp.next_validators_match(untrusted, &*hasher)?; // Ensure the header matches the commit vp.header_matches_commit(&untrusted.signed_header, hasher)?; @@ -266,7 +266,7 @@ pub fn verify( if untrusted.height() == trusted_next_height { // If the untrusted block is the very next block after the trusted block, // check that their (next) validator sets hashes match. - vp.valid_next_validator_set(&untrusted, trusted)?; + vp.valid_next_validator_set(untrusted, trusted)?; } else { // Otherwise, ensure that the untrusted block has a greater height than // the trusted block. diff --git a/light-client/src/store/memory.rs b/light-client/src/store/memory.rs index 6af7389c5..300adb2ea 100644 --- a/light-client/src/store/memory.rs +++ b/light-client/src/store/memory.rs @@ -81,6 +81,7 @@ impl LightStore for MemoryStore { .map(|(_, e)| e.light_block.clone()) } + #[allow(clippy::needless_collect)] fn all(&self, status: Status) -> Box> { let light_blocks: Vec<_> = self .store diff --git a/light-client/src/supervisor.rs b/light-client/src/supervisor.rs index d0b1afc32..0d356d0b1 100644 --- a/light-client/src/supervisor.rs +++ b/light-client/src/supervisor.rs @@ -320,7 +320,7 @@ impl Supervisor { .collect(); self.fork_detector - .detect_forks(verified_block, &trusted_block, witnesses) + .detect_forks(verified_block, trusted_block, witnesses) } /// Run the supervisor event loop in the same thread. diff --git a/tendermint/src/abci/tag.rs b/tendermint/src/abci/tag.rs index 657a19eec..e610c6d34 100644 --- a/tendermint/src/abci/tag.rs +++ b/tendermint/src/abci/tag.rs @@ -82,7 +82,7 @@ mod test { #[test] fn tag_serde() { let json = r#"{"key": "cGFja2V0X3RpbWVvdXRfaGVpZ2h0", "value": "MC00ODQw"}"#; - let tag: Tag = serde_json::from_str(&json).unwrap(); + let tag: Tag = serde_json::from_str(json).unwrap(); assert_eq!("packet_timeout_height", tag.key.0); assert_eq!("0-4840", tag.value.0); } diff --git a/tendermint/src/chain/id.rs b/tendermint/src/chain/id.rs index d770fe089..0e5c561ba 100644 --- a/tendermint/src/chain/id.rs +++ b/tendermint/src/chain/id.rs @@ -55,7 +55,7 @@ impl Id { /// Get the chain ID as a raw bytes. pub fn as_bytes(&self) -> &[u8] { - &self.0.as_str().as_bytes() + self.0.as_str().as_bytes() } } diff --git a/testgen/src/tester.rs b/testgen/src/tester.rs index cc03d340c..0a9dc2114 100644 --- a/testgen/src/tester.rs +++ b/testgen/src/tester.rs @@ -269,7 +269,7 @@ impl Tester { T: 'static + DeserializeOwned + UnwindSafe, F: Fn(T) + UnwindSafe + RefUnwindSafe + 'static, { - let test_fn = move |_path: &str, input: &str| match parse_as::(&input) { + let test_fn = move |_path: &str, input: &str| match parse_as::(input) { Ok(test_case) => Tester::capture_test(|| { test(test_case); }), @@ -288,7 +288,7 @@ impl Tester { { let test_env = self.env().unwrap(); let output_env = self.output_env().unwrap(); - let test_fn = move |path: &str, input: &str| match parse_as::(&input) { + let test_fn = move |path: &str, input: &str| match parse_as::(input) { Ok(test_case) => Tester::capture_test(|| { // It is OK to unwrap() here: in case of unwrapping failure, the test will fail. let dir = TempDir::new().unwrap(); @@ -311,7 +311,7 @@ impl Tester { T: 'static + DeserializeOwned, F: Fn(T) -> Vec<(String, String)> + 'static, { - let batch_fn = move |_path: &str, input: &str| match parse_as::(&input) { + let batch_fn = move |_path: &str, input: &str| match parse_as::(input) { Ok(test_batch) => Some(batch(test_batch)), Err(_) => None, }; diff --git a/testgen/src/validator_set.rs b/testgen/src/validator_set.rs index 44da67af4..0acfed561 100644 --- a/testgen/src/validator_set.rs +++ b/testgen/src/validator_set.rs @@ -48,7 +48,7 @@ impl Generator for ValidatorSet { } fn generate(&self) -> Result { - let vals = generate_validators(&self.validators.as_ref().unwrap())?; + let vals = generate_validators(self.validators.as_ref().unwrap())?; Ok(validator::Set::without_proposer(vals)) } }