Implicitly "importing" enum variants (and potentially other types?) for fn
arguments might be an interesting ergonomic win by reducing verbosity and eliminating the need to have use
statements, but I personally find that kind of implicitness distasteful, simply because it breaks my code navigation workflow of grepping for the use
statement to figure out where the definition is. "Go to definition" using rust-analyzer and RLS makes up for it, but it also makes it harder for any one without tooling, and almost impossible for people that don't know about the ergonomic rule (where they would just have to look for the function's definition).
Beyond those concerns, I would also wish to perform extensive testing to see what the behavior would be in cases of common mistakes, name clashes, typos, privacy errors, etc. for something like that.
Finally, I would have to say that yes, this would be really nice, making it only for enum variants might be reasonable, if inconsistent. The big advantage of this approach is that it side-steps the "syntax" conversation entirely. Another disadvantage is that this is not generalizable to the "inferred struct" feature (_ { foo, bar }
).