News for hackers. Stuff that matters.
Re:Where Everything Went Wrong: Error Handling and Error Mes... by safarimonkey on Tuesday February 23, 2021 @05:46AM (#26235795)
I ran into this the other day, and it took me a moment to realise that I could just use `matches!`:

    // want to do this
    if not let Some("pattern") = val {
        doSomething();
    }

    // can instead do
    if !matches!(val, Some("pattern")) {
        doSomething();
    }
edit: formatting

There are no comments on this comment yet.