this post was submitted on 17 Dec 2025
498 points (96.5% liked)

Programmer Humor

27922 readers
895 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] 30p87@feddit.org 26 points 1 day ago (134 children)

Almost any language is OK, but Rust is just so, so fucking ugly

[–] asudox@lemmy.asudox.dev 25 points 1 day ago (44 children)

what? what part of rust is ugly?

[–] rtxn@lemmy.world 4 points 1 day ago* (last edited 1 day ago) (15 children)

Enums and nested blocks. I understand the importance of Option and Result, but it's fucking infuriating when I have to check and destructure the result of every function call and either bubble the result up the stack from six levels of nested if let blocks or risk Cloudflaring my program by using .unwrap(). And while I like being able to extract a return value from an if...else expression, the structure gets really convoluted when multiple if and match blocks are nested (of course each one returning a value), and it gets completely fucked once closures are introduced.

I like Rust, but calling it pretty is delusional.

[–] tatterdemalion@programming.dev 3 points 19 hours ago

Enums are the best part of the Rust language IMO, so I'm not sure how you can view them as ugly. Having the choice to destructure something is fantastic. You generally aren't required to destructure every return value. Make sure you're using the ? operator as much as possible. If destructuring is getting in your way, it sounds like the code is not very idiomatic.

I can't really comment on your issue with nested if and match. Too much nesting is bad in any language; try extracting more functions and let bindings to make it more readable.

You can enable a clippy lint to deny .unwrap() if you're worried about it.

load more comments (14 replies)
load more comments (42 replies)
load more comments (131 replies)