Post #2227745
2025-11-19 17:01 UTC
@soc@chaos.social I like it! @Mara@hachyderm.io could this actually be a solution for Rust 1.X? All existing .unwrap_*() could be renamed to .get_*(), .unwrap() would become .get_or_panic(), .expect() would be .get_or_panic_with(), Result::unwrap_err() would become .get_err_or_panic(), and it all seems to align well with the existing Option::get_or_insert*().
.unwrap() name would become longer, but maybe it's actually not a bad thing to "increase the price" of panicking? Other `unwrap_*` methods would become shorter!
Replies (1)
-
@azymohliad@fosstodon.org 2025-11-19 17:17
@Mara@hachyderm.io @soc@chaos.social ah, never mind, .get_or_insert*()s take &mut self, and .unwrap*()s consume.