idanarye / rust-typed-builder

Compile-time type-checked builder derive
https://crates.io/crates/typed-builder
Apache License 2.0
904 stars 52 forks source link

Explicitly match unit type inside generated setters #110

Closed aumetra closed 1 year ago

aumetra commented 1 year ago

This PR changes the usage of _ to () inside setters.

When implementing a setter, the code will expand to something like this:

let (field, _) = self.fields;

While this is fine, with Rust 1.73 Clippy will introduce a new pedantic lint ignored_unit_patterns.
This will result in warnings on each usage of the TypedBuilder macro.

With this one-line change, the expanded code will change to something like this:

let (field, ()) = self.fields;