News for hackers. Stuff that matters.
Re:Swift is a more convenient Rust by hardwaresofton on Friday September 06, 2024 @09:08AM (#41465840)
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)
Re:Swift is a more convenient Rust by GrantMoyer on Friday September 06, 2024 @10:42AM (#41466683)
You can put the use statement in the function with the match, or even limit the scope further:

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