• dejected_warp_core@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      12 hours ago

      NGL, writing pure functions in Rust is fantastic. Writing responsible code that handles all the error conditions turns the “happy path” into hamburger. Even with the ergonomics of Result, Option, and even ?, code just sprawls and becomes a readability tradeoff. I’m only a few months into Rust at this point, and I have a lot to learn, but it’s tempting to just .unwrap() and .expect() where I think it’s unlikely to fail.

      • Strawberry@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        4
        ·
        7 hours ago

        That’s honestly fine in your application code, but very frustrating to see in library code on crates.io. Nobody wants library code to panic over some nonessential functionality that the calling code could’ve recovered from.