• anton@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    4
    ·
    2 years ago

    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.worksOP
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

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