Hacker News new | ask | show | jobs
by hardwaresofton 651 days ago
I’ve never done this but this is a great point. I think I’d avoid doing this though because variants often have really short, reusable/general names (leaning into the overall type name being close)
1 comments

You can put the use statement in the function with the match, or even limit the scope further:

  {
    use MyEnum::*;
    match my_enum {…}
  }