Closed
Description
Although I know Enums take to form of:
enum VecOrMap{
Vec(Vec<usize>),
Map(HashMap<String,usize>)
}
I sometimes find myself accidentally defining them as I would a Struct (playground):
enum VecOrMap{
vec: Vec<usize>,
map: HashMap<String,usize>
}
The current output is:
Compiling playground v0.0.1 (/playground)
error: expected one of `(`, `,`, `=`, `{`, or `}`, found `:`
--> src/lib.rs:2:8
|
2 | vec: Vec<usize>,
| ^ expected one of `(`, `,`, `=`, `{`, or `}`
error: expected item, found `:`
--> src/lib.rs:2:8
|
2 | vec: Vec<usize>,
| ^ expected item
error: could not compile `playground` due to 2 previous errors
This always takes more than a few seconds to parse and then realize my mistake.
Is it possible to change this to something like:
It looks like you are trying to define an Enum using Struct syntax, change `vec: Vec<usize>` to `Vec(Vec<usize>)`