Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #16752 - Lindronics:destructure-struct-binding, r=Veykril
fix: Don't destructure struct with no public fields Unfortunately I missed this case in #16638. If a struct only has private members, the assist should not be applicable. Though valid syntax exists (`Foo { .. }`), it isn't particularly useful. Since this case applies to a lot of common types (`Arc`, `Vec`, ...), it probably makes the most sense to hide the action. As a side effect, this also disables the action for unit structs, where it also isn't particularly useful. I'd be open to changing it though if you think it makes more sense to keep it. This also fixes the `make::record_pat_field_list` function to produce valid syntax if the field list is empty, as it is used in other places too. ## Current behaviour ```rust // In crate `other_crate` pub struct Foo { bar: i32 } // In current crate fn do_something(foo: other_crate::Foo) {} // Becomes fn do_something(other_crate::Foo { , .. }: other_crate::Foo) {} ``` ## Fixed behaviour Assist should not be applicable in this case anymore.
- Loading branch information