#![feature(field_init_shorthand)]
struct AA{}
struct BB{}
struct CC {
a: AA,
b: BB
}
impl CC {
fn new(a: AA, b: BB) -> Self {
Self { a, b }
}
}
cargo fmt error:
error: expected `:`, found `,`
--> /tmp/foo/src/lib.rs:13:17
|
13 | Self { a, b }
| ^
The message is created in one of the following places:
Should this issue be in this repository?
Probably it belongs to https://github.com/serde-rs/syntex
Weird. Looks like it doesn't error anymore on master. This works. Instead it just inserts the field names. I don't see the commit changing it though.
Is there any progress on this?
It appears that this works in the latest rustfmt, but it defaults to expanding out the shorthand. I think that the default should be to always use the shorthand when possible.
Most helpful comment
It appears that this works in the latest rustfmt, but it defaults to expanding out the shorthand. I think that the default should be to always use the shorthand when possible.