Skip to content

Commit

Permalink
Fix clippy lints for Rust 1.65 (#1223)
Browse files Browse the repository at this point in the history
Signed-off-by: Thane Thomson <connect@thanethomson.com>

Signed-off-by: Thane Thomson <connect@thanethomson.com>
  • Loading branch information
thanethomson authored Nov 5, 2022
1 parent 2ce1789 commit 3c28657
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion light-client-verifier/src/operations/commit_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl CommitValidator for ProdCommitValidator {
} => validator_address,
};

if validator_set.validator(*validator_address) == None {
if validator_set.validator(*validator_address).is_none() {
return Err(VerificationError::faulty_signer(
*validator_address,
self.hasher.hash_validator_set(validator_set),
Expand Down
2 changes: 1 addition & 1 deletion p2p/src/secret_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl Handshake<AwaitingEphKey> {
protocol_version: Version,
) -> (Self, EphemeralPublic) {
// Generate an ephemeral key for perfect forward secrecy.
let local_eph_privkey = EphemeralSecret::new(&mut OsRng);
let local_eph_privkey = EphemeralSecret::new(OsRng);
let local_eph_pubkey = EphemeralPublic::from(&local_eph_privkey);

(
Expand Down
2 changes: 1 addition & 1 deletion proto/tests/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl TryFrom<RawBlockId> for BlockId {
Ok(BlockId {
hash: String::from_utf8(value.hash)
.map_err(|_| "Could not convert vector to string")?,
part_set_header_exists: value.part_set_header != None,
part_set_header_exists: value.part_set_header.is_some(),
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions tendermint/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ mod tests {
// If `from_value` is the inverse of `to_value`, then it will always
// map the JSON `encoded_time` to back to the inital `time`.
let time: Time = datetime.try_into().unwrap();
let json_encoded_time = serde_json::to_value(&time).unwrap();
let json_encoded_time = serde_json::to_value(time).unwrap();
let decoded_time: Time = serde_json::from_value(json_encoded_time).unwrap();
prop_assert_eq!(time, decoded_time);
}
Expand All @@ -273,7 +273,7 @@ mod tests {
// arbitrarily generated textual timestamps, rather than times in a
// range. Tho we do incidentally test the inversion as well.
let time: Time = stamp.parse().unwrap();
let json_encoded_time = serde_json::to_value(&time).unwrap();
let json_encoded_time = serde_json::to_value(time).unwrap();
let decoded_time: Time = serde_json::from_value(json_encoded_time).unwrap();
prop_assert_eq!(time, decoded_time);
}
Expand Down
2 changes: 1 addition & 1 deletion testgen/src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Generator<block::Commit> for Commit {

let vote_to_sig = |v: &Vote| -> Result<block::CommitSig, SimpleError> {
let vote = v.generate()?;
if vote.block_id == None {
if vote.block_id.is_none() {
Ok(block::CommitSig::BlockIdFlagNil {
validator_address: vote.validator_address,
timestamp: vote.timestamp.unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion testgen/src/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ impl Tester {
let output_dir = output_env.full_path(path);
let output_env = TestEnv::new(output_dir.to_str().unwrap()).unwrap();
test(test_case, &env, &test_env, &output_env);
fs::remove_dir_all(&env.current_dir()).unwrap();
fs::remove_dir_all(env.current_dir()).unwrap();
}),
Err(e) => ParseError(e),
};
Expand Down

0 comments on commit 3c28657

Please sign in to comment.