I like. _
in type context already means “please infer this”, so using it for struct literals makes sense. FRU is a documentation example for Default
, and I can’t imagine any other no-parameter thing that would make sense. Plus the symmetry with pattern syntax is nice. (I also think that it’s cool that pseudo-code already tends to look like { a: 4, .. }
, and now it’d compile )
Here are some more places where the same or similar things have come up:
- Allow a trailing `..` in a struct literal, meaning `.. Default::default()`
- https://github.com/rust-lang/rfcs/pull/1806
- [Pre-RFC]: Unnamed struct types
Maybe it just needs someone to write an RFC? (Or maybe three, since they’re separable.)