this post was submitted on 11 Jun 2024
231 points (96.8% liked)

Programmer Humor

19331 readers
19 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 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] anton@lemmy.blahaj.zone 6 points 4 months ago (5 children)

Instead of

if let Some(a_) = a{
    ()
} else if let Some(b_)=b{
    ()
} else {
    dostuff 
}

you could just use

if a.isNone()&&b.isNone(){
    dostuff
}

Also if you don't use the value in a match just use _

[โ€“] Thelie@sh.itjust.works 2 points 4 months ago

That's a good point, thanks. Maybe I'll go without the if entirely, the (janky) code is still very much in flux ;)

load more comments (4 replies)