Structopt: clippy warning when using structopt

Created on 19 Sep 2019  路  3Comments  路  Source: TeXitoi/structopt

I am getting some clippy warnings as of lately. The CI server spits out the following:

warning: returning the result of a let binding from a block
   --> src/config.rs:147:26
    |
147 | #[derive(Debug, Default, StructOpt)]
    |                          ^^^^^^^^^
...
171 |     #[structopt(flatten)]
    |                 ------- unnecessary let binding
    |
    = note: #[warn(clippy::let_and_return)] on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return

The mentioned line can be found here, but as far as I can tell there is nothing wrong with it.

Most helpful comment

@TeXitoi Nope, according to this thread clippy-guys (I hope that's the correct tittle) suggest to insert some #[allow(clippy::whatever)] into generated code to suppress them. This is what I propose we're doing

All 3 comments

Yep, the code generated may be sometimes somewhat complicated and redundant. We'll fix this warning in v0.3.3

I was thinking clippy should not warn in code generated by proc macro anymore, no?

@TeXitoi Nope, according to this thread clippy-guys (I hope that's the correct tittle) suggest to insert some #[allow(clippy::whatever)] into generated code to suppress them. This is what I propose we're doing

Was this page helpful?
0 / 5 - 0 ratings