Skip to content

Fix clippy errors#108

Merged
liamsi merged 1 commit intoismail/light_store_requests_bisectfrom
ismail/fix_new_clippy_errs
Dec 28, 2019
Merged

Fix clippy errors#108
liamsi merged 1 commit intoismail/light_store_requests_bisectfrom
ismail/fix_new_clippy_errs

Conversation

@liamsi
Copy link
Contributor

@liamsi liamsi commented Dec 28, 2019

New clippy errors since the latest rust stable release:

Expand circle log

error: redundant clone
  --> tendermint/src/block/commit.rs:35:15
   |
35 |         self.0.clone()
   |               ^^^^^^^^ help: remove this
   |
note: lint level defined here
  --> tendermint/src/lib.rs:8:5
   |
8  |     warnings,
   |     ^^^^^^^^
   = note: `#[deny(clippy::redundant_clone)]` implied by `#[deny(warnings)]`
note: this value is dropped without further use
  --> tendermint/src/block/commit.rs:35:9
   |
35 |         self.0.clone()
   |         ^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

error: `if` chain can be rewritten with `match`
  --> tendermint/src/consensus/state.rs:52:9
   |
52 | /         if self.height < other.height {
53 | |             Ordering::Less
54 | |         } else if self.height == other.height {
55 | |             if self.round < other.round {
...  |
63 | |             Ordering::Greater
64 | |         }
   | |_________^
   |
note: lint level defined here
  --> tendermint/src/lib.rs:8:5
   |
8  |     warnings,
   |     ^^^^^^^^
   = note: `#[deny(clippy::comparison_chain)]` implied by `#[deny(warnings)]`
   = help: Consider rewriting the `if` chain to use `cmp` and `match`.
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_chain

error: `if` chain can be rewritten with `match`
  --> tendermint/src/consensus/state.rs:55:13
   |
55 | /             if self.round < other.round {
56 | |                 Ordering::Less
57 | |             } else if self.round == other.round {
58 | |                 self.step.cmp(&other.step)
59 | |             } else {
60 | |                 Ordering::Greater
61 | |             }
   | |_____________^
   |
   = help: Consider rewriting the `if` chain to use `cmp` and `match`.
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_chain

error: redundant clone
  --> tendermint/src/block/commit.rs:35:15
   |
35 |         self.0.clone()
   |               ^^^^^^^^ help: remove this
   |
note: lint level defined here
  --> tendermint/src/lib.rs:8:5
   |
8  |     warnings,
   |     ^^^^^^^^
   = note: `#[deny(clippy::redundant_clone)]` implied by `#[deny(warnings)]`
note: this value is dropped without further use
  --> tendermint/src/block/commit.rs:35:9
   |
35 |         self.0.clone()
   |         ^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

error: `if` chain can be rewritten with `match`
  --> tendermint/src/consensus/state.rs:52:9
   |
52 | /         if self.height < other.height {
53 | |             Ordering::Less
54 | |         } else if self.height == other.height {
55 | |             if self.round < other.round {
...  |
63 | |             Ordering::Greater
64 | |         }
   | |_________^
   |
note: lint level defined here
  --> tendermint/src/lib.rs:8:5
   |
8  |     warnings,
   |     ^^^^^^^^
   = note: `#[deny(clippy::comparison_chain)]` implied by `#[deny(warnings)]`
   = help: Consider rewriting the `if` chain to use `cmp` and `match`.
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_chain

error: `if` chain can be rewritten with `match`
  --> tendermint/src/consensus/state.rs:55:13
   |
55 | /             if self.round < other.round {
56 | |                 Ordering::Less
57 | |             } else if self.round == other.round {
58 | |                 self.step.cmp(&other.step)
59 | |             } else {
60 | |                 Ordering::Greater
61 | |             }
   | |_____________^
   |
   = help: Consider rewriting the `if` chain to use `cmp` and `match`.
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_chain

error: aborting due to 3 previous errors

error: could not compile `tendermint`.

@liamsi liamsi changed the base branch from master to ismail/light_store_requests_bisect December 28, 2019 14:56
@liamsi liamsi merged commit 20124e2 into ismail/light_store_requests_bisect Dec 28, 2019
@ebuchman ebuchman deleted the ismail/fix_new_clippy_errs branch December 28, 2019 15:50
Copy link
Contributor

@ebuchman ebuchman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

ebuchman added a commit that referenced this pull request Dec 29, 2019
* Add bisection to light client module:

 - implement `can_trust` according to the latest spec CanTrustBisection (wip)
 - add a `Requester` and a `Store` trait
 - sue refs in parameters (as they are used in several places and we don't want to Copy)

* Group params h1 & ha_next_vals into a type `TrustedState`

 - reduce params to clippy threshold (7); still a lot ...
 - rename vars for better readability

* Add VerifyHeader logic from spec:

 - rename expired to is_within_trust_period to be closer to the spec
 - use TrusteState trait in check_support params
 - use TrusteState in lite tests

* Review: doc improvements and minor improvements on naming

* Review: doc improvements

* More doc improvements

* Minor doc improvement

* MockHeader and test_is_within_trust_period (#104)

* MockHeader and test_is_within_trust_period

* remove Validator trait; make ValidatorSet associated to Commit (#105)

* remove Validator trait; make ValidatorSet associated to Commit

* remove stale comment

* Fix clippy errors (#108)

* Review comments: (#107)

* Review comments:

 - update some comments / documentation
 - verify vals (not next vals)
 - store header and vals in trusted state

* One offs & renaming related to trusted state

* Rename & remove redundant store of trusted state: c
 - an_trust -> can_trust_bisection
 - remove a redundant check for trust period
 - remove redundant adding state to the store (added TODO)

* Bucky/some light follow up (#109)

* use ? instead of return Err(err)

* remove unused errors

* move a validation and add TODOs about them

* check_support returns early for sequential case

* drop let _ =

* add comment to voting_power_in about signers

Co-authored-by: Ethan Buchman <ethan@coinculture.info>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants