News for hackers. Stuff that matters.
Re:Several core problems with Rust by dana321 on Monday November 24, 2025 @06:35AM (#46032960)
It was bad coding.

.unwrap() is not required to be used.

use:

if let Some(value)=something_to_unwrap{

}else{ // log an error and exit!! }

Re:Several core problems with Rust by Measter on Monday November 24, 2025 @08:39AM (#46033960)
Fun fact: that's what an unwrap does. It panics, which causes the error to be logged and the thread ended.
Re:Several core problems with Rust by drannex on Monday November 24, 2025 @02:49PM (#46038402)
And one of the fun things about how unwrap() does that automatically, is that if you are working with an orchestrator with retry logic, you won't need to (re-re-re-re-re-)write your own for the entire program - the orchestrator will see the error, log its output, and try again in high volume workloads, or move on to the next request - this is incredible and nice to use especially when a failure in one request doesn't need to fail the entire application for all requests.

I shy away from unwrap() in almost all cases (as should anyone!) but if you are running a modular system, then unwrap when placed strategically can be incredibly useful.

Re:Several core problems with Rust by leoh on Monday November 24, 2025 @03:35PM (#46038968)
I think the commenter meant "return a Result<_>" instead of exit. Your snark is perhaps amusing, but not particularly charitable.
Re:Several core problems with Rust by nrds on Monday November 24, 2025 @01:29PM (#46037300)
Maybe rust should put a function in the core library which does this! Send a PR!
Re:Several core problems with Rust by 15155 on Monday November 24, 2025 @01:53PM (#46037636)