Skip to content

refactor(esplora): Simplify chain update logic

Sign in for the full log view
GitHub Actions / clippy failed Apr 2, 2024 in 0s

clippy

2 errors

Details

Results

Message level Amount
Internal compiler error 0
Error 2
Warning 0
Note 0
Help 0

Versions

  • rustc 1.77.1 (7cf61ebde 2024-03-27)
  • cargo 1.77.1 (e52e36006 2024-03-26)
  • clippy 0.1.77 (7cf61eb 2024-03-27)

Annotations

Check failure on line 210 in crates/chain/src/local_chain.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

`if` chain can be rewritten with `match`

error: `if` chain can be rewritten with `match`
   --> crates/chain/src/local_chain.rs:197:13
    |
197 | /             if cp.height() == block_id.height {
198 | |                 if cp.hash() == block_id.hash {
199 | |                     return self;
200 | |                 } else {
...   |
209 | |                 tail.push(cp.block_id());
210 | |             }
    | |_____________^
    |
    = 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
    = note: `-D clippy::comparison-chain` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::comparison_chain)]`

Check failure on line 218 in crates/chain/src/local_chain.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

returning the result of a `let` binding from a block

error: returning the result of a `let` binding from a block
   --> crates/chain/src/local_chain.rs:218:9
    |
214 | /         let tip = base
215 | |             .extend(core::iter::once(block_id).chain(tail.into_iter().rev()))
216 | |             .expect("tail is in order");
    | |________________________________________- unnecessary `let` binding
217 |
218 |           tip
    |           ^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
    = note: `-D clippy::let-and-return` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::let_and_return)]`
help: return the expression directly
    |
214 ~         
215 | 
216 ~         base
217 +             .extend(core::iter::once(block_id).chain(tail.into_iter().rev()))
218 +             .expect("tail is in order")
    |