This question is now obsolete because this feature has been implemented. Related answer.
The following Rust code fails to compile:
enum Foo {
If the enum name Foo is in reality long and you want to avoid repeating it across the implementation, you have two options:
use LongEnumName as Short at module level. This will allow you to return Short::Bar at the end of f.use LongEnumName::* at module level, allowing an even shorter Bar.If you omit pub, the imports will be internal and won't affect the public API of the module.