paritytech/parity-scale-codec

parity-scale-codec-derive 3.6.0 generates a lot of clippy warnings

Closed this issue · 5 comments

Upgraded from 3.1.4 to 3.6.0 and getting a lot of warnings like these in generated code:

warning: unneeded `return` statement
   --> crates/subspace-archiving/src/archiver.rs:170:5
    |
170 | /     /// Segment header of the parent
171 | |     #[codec(index = 4)]
172 | |     ParentSegmentHeader(SegmentHeader),
    | |______________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    = help: remove `return`
warning: try not to call a closure in the expression where it is declared
  --> crates/subspace-networking/src/request_handlers/peer_info.rs:11:5
   |
11 | /     /// Special status for starting peer. Receiving it in the running mode means an error.
12 | |     Unknown,
   | |___________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
   = note: `#[warn(clippy::redundant_closure_call)]` on by default
help: try doing something like
   |
11 ~     /// Special status for starting peer. Receiving it in the running mode means an error.
12 ~     Unknown,
   |

I think they need to be fixed or suppressed for generated code.

ggwpez commented

Yea… same is happening in Polkadot paritytech/polkadot#7382

ggwpez commented

@koute the closure warning be this one maybe:

return (move || {

koute commented

Ah, yep. I'll fix it.

We had the same problem in ink!

koute commented

PR with a fix here: #455