News for hackers. Stuff that matters.
Re:Dave Herman’s contributions to Rust by iudqnolq on Thursday May 06, 2021 @05:50PM (#27069462)
Outside of tests and toy examples you're generally expected to only panic when the developer has failed to uphold an invariant, not when the user has. As a result there's generally nothing a non-rust-developer can do with the message besides post it on the bug tracker.
Re:Dave Herman’s contributions to Rust by da39a3ee on Thursday May 06, 2021 @09:34PM (#27070949)
Right, so that's relevant to a minor incidental comment I made. But what do you think of the main points, which are

(a) If you write the message the way you suggest the printed error message is misleading, and

(b) The Rust community does not encourage using .expect() in the way you suggest; in particular the canonical Rust documentation source instructs us to use it as

  foo.expect("A thing I do not expect")
Re:Dave Herman’s contributions to Rust by da39a3ee on Sunday May 09, 2021 @08:57AM (#27095584)
Similarly, from the rust stdlib docs for process::Command

  let hello_1 = echo_hello.output().expect("failed to execute process");