TedDriggs / darling

A Rust proc-macro attribute parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`clippy` warns about use of `if let` in generated code

bruceg opened this issue · comments

When using #[darling(default)], clippy warns that an if let can be simplified:

error: if let can be simplified with `.unwrap_or_default()`
   --> lib/vector-config-common/src/validation.rs:178:19
    |
178 |         #[darling(default, rename = "min")]
    |                   ^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default

The above lint is newly enabled in Rust 1.79.

I suspect the above is caused by the construct here, which indeed could be simplified with either .unwrap_or(#expr) or .unwrap_or_default() depending on the use case.

There is a PR for this, but last activity is two weeks ago :) #292

This has been fixed by #296; release is imminent

This has now been released in 0.20.10