Thelie@sh.itjust.works to Programmer Humor@programming.devEnglish · 25 days agoProgramming as a hobby means I can do whatever I want!sh.itjust.worksimagemessage-square21fedilinkarrow-up1240arrow-down18
arrow-up1232arrow-down1imageProgramming as a hobby means I can do whatever I want!sh.itjust.worksThelie@sh.itjust.works to Programmer Humor@programming.devEnglish · 25 days agomessage-square21fedilink
minus-squareanton@lemmy.blahaj.zonelinkfedilinkarrow-up5·23 days agoInstead 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 _
minus-squarejimitsoni18@lemmy.ziplinkfedilinkarrow-up4·23 days agoAlso you can use enums insteas of string literals
minus-squareThelie@sh.itjust.worksOPlinkfedilinkarrow-up0·22 days agoI’m not sure how I would go about this in an elegant way since I’m matching the string I get from a message…
minus-squarejimitsoni18@lemmy.ziplinkfedilinkarrow-up1·15 days agoIf the message used enums for actions/procedures like SPAM_MEMES, then using enums would be more performant
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
_
Also you can use enums insteas of string literals
I’m not sure how I would go about this in an elegant way since I’m matching the string I get from a message…
If the message used enums for actions/procedures like SPAM_MEMES, then using enums would be more performant