• cbarrick@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    1
    ·
    5 months ago

    You talk about “non-absolutist,” but this thread got started because the parent comment said “literally never.”

    I am literally making the point that the absolutist take is bad, and that there are good reasons to call unwrap in prod code.

    smdh

    • BB_C
      link
      fedilink
      arrow-up
      1
      arrow-down
      2
      ·
      5 months ago

      Don’t get angry with me my friend. We are more in agreement than not re panics (not .unwrap(), another comment coming).

      Maybe I’m wrong, but I understood ‘literally’ in ‘literally never’ in the way young people use it, which doesn’t really mean ‘literally’, and is just used to convey exaggeration.

      • taladar@sh.itjust.works
        link
        fedilink
        arrow-up
        2
        ·
        5 months ago

        No, I actually meant it as in the traditional meaning of literally. As in

        [lints.clippy]
        unwrap_used = "warn"
        expect_used = "warn"
        

        along with a pre-commit hook that does

        cargo clippy -D warnings

        (deny warnings).

        There are always better ways to write an unwrap, usually via pattern matching and handling the error cases properly, at the very least logging them.