this post was submitted on 17 Dec 2025
429 points (96.7% liked)

Programmer Humor

27920 readers
1657 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
[–] asudox@lemmy.asudox.dev 22 points 1 day ago (4 children)

what? what part of rust is ugly?

[–] UnderpantsWeevil@lemmy.world 18 points 1 day ago (2 children)

Maybe they're confusing the literal name with the language? Idk.

I grew up on Perl and holy fuck... Rust is fine.

[–] hellfire103@lemmy.ca 7 points 1 day ago

I'm learning Perl - purely for fun - and yeah... it's a little funky.

[–] jackr@lemmy.dbzer0.com 5 points 21 hours ago

Perl is ugly but great. It's like shell scripting with a more solid programming language. I'd never use it outside of simple scripts in my os, but whenever I do use it it's very fun. Anyway, yeah, rust looks fine to me. Maybe they are not very experienced with it? I know some of my programs used to have lines with just x.unwrap().unwrap().unwrap() or whatever, which is not pretty.

[–] rtxn@lemmy.world 5 points 1 day ago* (last edited 1 day ago) (7 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.

[–] roanutil_@programming.dev 17 points 1 day ago

Sum types with associated values are worth it

[–] marcos@lemmy.world 16 points 1 day ago (1 children)

have to check and destructure the result of every function call

Learn how to use enum error types, how error bubbling works, and how to convert between Options and Results.

It's Rust you are talking about, not Go.

[–] rtxn@lemmy.world -4 points 1 day ago (1 children)

This isn't about some feature of the language being good or bad. It's about Rust being ugly or not. The things I mentioned will always look ugly in the source code.

[–] 5C5C5C@programming.dev 10 points 23 hours ago

It's hilarious to me that people talk about "ugly" as if their opinions are objective.

I found Rust unpleasant to look at for the first two weeks of learning it, and now that I've been using it professionally for three years I loathe when I need to read code in other languages.

No other language can rival Rust in showing the exact information needed to understand the code


never too much and never too little


while being concise, correct, and handling all edge cases.

You can be more concise in other languages, but it will come the loss of handling every little possible bug. You can be prettier in other languages, but it will come at the price of adding a lot of useless boilerplate.

Of course there are cases where Rust can be verbose or confusing, but that's when you're doing very esoteric things that would be just as confusing in other languages.

Like any opinion on aesthetics, how someone feels about the prettiness of a language will have far more to do with familiarity than with any objective metrics.

[–] magic_lobster_party@fedia.io 6 points 21 hours ago

I like to use unwrap_or() to define fallback values. The Option API is quite expressive.

[–] eager_eagle@lemmy.world 6 points 1 day ago

Cloudflaring my program

I'll start using this one

[–] SorryQuick@lemmy.ca 4 points 13 hours ago* (last edited 13 hours ago)

You can also use let else.

let (Some(count\_str), Some(item)) = (it.next(), it.next()) else {
    panic!("Can't segment count item pair: '{s}'");
};

But really it’s the exact same as other languages, it just forces you to handle it better. C-based languages will return 0/null/-1 and you’ll have to check all 3 of those because they might not mean the same thing. How is that better?

[–] tatterdemalion@programming.dev 1 points 5 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.

[–] calcopiritus@lemmy.world 1 points 10 hours ago

Most of the times you can just let ... else (which is basically a custom ? if you need if let ... else it's because you actually need 2 branching code paths. In any other language you also do if ... else when you have 2 different code branches. I don't see why this is a rust-specific issue.

[–] 30p87@feddit.org 4 points 1 day ago (2 children)

Literally every single bit of the syntax.

[–] Kacarott@aussie.zone 10 points 23 hours ago (1 children)

The majority of its syntax is very similar to many other languages. Can you give an example of a language with pretty syntax?

[–] 30p87@feddit.org -1 points 21 hours ago (1 children)

Key point being, similar to some random languages. JS and Python Syntax don't fit a typed and compiled language at all.

Pretty syntax would probably be something like C, where not every single character already widely reserved for specific keywords (like !, ', =) is reused in completely random ways.

[–] Kacarott@aussie.zone 6 points 19 hours ago* (last edited 19 hours ago)

Ah yes I also found macro syntax like vec![ and println!( to be a bit jarring at first. However I don't know if I would say that C's approach to macros is any nicer, with it's #define magic

[–] 5C5C5C@programming.dev -2 points 23 hours ago (1 children)

Being unable to give an actual example proves you're just a foaming-mouth hater with nothing to contribute.