Closed
Description
warning: You matched a field with a wildcard pattern. Consider using `..` instead, #[warn(unneeded_field_pattern)] on by default
--> src/engine/phases/incremental_sync_step.rs:398:55
|
398 | let UpdateHiddenStateReq{root_relative_paths, infinitize_unignores: _} = req;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Try with `UpdateHiddenStateReq { root_relative_paths, .. }`
= help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#unneeded_field_pattern
Here is an an exact warning from our code. We have a large codebase (several tens of thousands of lines) and get a lot of refactor value out of having a complete destructure without .. syntax.
When we use {..} it increases the probability that someone changes the fields of UpdateHiddenStateReq and forgets to change the usage site here.
One of rust's biggest advantages for us is how it prevents us from shooting ourselves in the foot during refactors or edits in situations like this.
Now I understand that not everyone has this concern and the .. syntax definitely has its benefits, but I do think it's worth discussing if this should be a warning. What do you think?
Thanks