Today I’m sharing a little trick that I like to use to make switch statements cleaner and more type-safe. Happy to hear other ideas!

  • sbv
    link
    fedilink
    English
    arrow-up
    2
    ·
    9 months ago

    I really appreciate compile errors in this scenario. In Rust the compiler will freak out when there are missing enum variants in a match. Tests are great, but compiler errors don’t rely on exhaustive and properly written tests.