this post was submitted on 01 Aug 2025
151 points (96.9% liked)

Programmer Humor

25425 readers
973 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

Don't say anyway, say anyhow

you are viewing a single comment's thread
view the rest of the comments
[–] sirdorius@programming.dev 41 points 2 days ago (16 children)
[–] somerandomperson@lemmy.dbzer0.com 20 points 2 days ago (14 children)

Sad to be the one that does not get it.

[–] magic_lobster_party@fedia.io 36 points 2 days ago (6 children)

Unwrap means it forces to evaluate the result as an ”ok value”. If it’s an ”error value”, it will crash. It’s a bad practice to rely on it, as it’s one of the most common ways a Rust programs can crash.

Rust offers many options to handle errors that don’t risk crashing. For example, unwrap_or_default, which means ”if it’s an error value, use the default value for this type, such as 0 for integers”

[–] sirdorius@programming.dev 7 points 2 days ago* (last edited 2 days ago)

Unwrap is good for prototyping and trying out stuff fast, but it generally shouldn't make it past a code review onto main, unless you're very sure

load more comments (5 replies)
load more comments (12 replies)
load more comments (13 replies)