Skip to content

Commit

Permalink
Fix new Clippy warnings as of Rust 1.49 (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Jan 5, 2021
1 parent a117871 commit e65337a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
20 changes: 12 additions & 8 deletions tendermint/src/vote/sign_vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,12 @@ mod tests {

// with proper (fixed size) height and round (Precommit):
{
let mut vt_precommit = Vote::default();
vt_precommit.height = Height::from(1_u32);
vt_precommit.round = Round::from(1_u16);
vt_precommit.vote_type = Type::Precommit; // precommit
let vt_precommit = Vote {
height: Height::from(1_u32),
round: Round::from(1_u16),
vote_type: Type::Precommit,
..Default::default()
};
println!("{:?}", vt_precommit);
let cv_precommit = CanonicalVote::new(vt_precommit, ChainId::try_from("A").unwrap());
let got = cv_precommit.encode_vec().unwrap();
Expand All @@ -309,10 +311,12 @@ mod tests {
}
// with proper (fixed size) height and round (Prevote):
{
let mut vt_prevote = Vote::default();
vt_prevote.height = Height::from(1_u32);
vt_prevote.round = Round::from(1_u16);
vt_prevote.vote_type = Type::Prevote;
let vt_prevote = Vote {
height: Height::from(1_u32),
round: Round::from(1_u16),
vote_type: Type::Prevote,
..Default::default()
};

let cv_prevote = CanonicalVote::new(vt_prevote, ChainId::try_from("A").unwrap());

Expand Down
4 changes: 3 additions & 1 deletion testgen/src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@ impl Generator<block::Commit> for Commit {
None => self.clone().generate_default_votes().votes.unwrap(),
Some(vs) => vs.to_vec(),
};

let all_vals = header.validators.as_ref().unwrap();
let mut all_vals: BTreeSet<&Validator> = BTreeSet::from_iter(all_vals);
let votes_vals: Vec<Validator> =
votes.iter().map(|v| v.validator.clone().unwrap()).collect();
all_vals.append(&mut BTreeSet::from_iter(&votes_vals));
let all_vals: Vec<Validator> = Vec::from_iter(all_vals.iter().map(|&x| x.clone()));
let all_vals: Vec<Validator> = all_vals.iter().map(|&x| x.clone()).collect();
let all_vals = sort_validators(&all_vals);

let vote_to_sig = |v: &Vote| -> Result<block::CommitSig, SimpleError> {
let vote = v.generate()?;
if vote.block_id == None {
Expand Down

0 comments on commit e65337a

Please sign in to comment.