• @[email protected]
    link
    fedilink
    518 days 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 _

      • @[email protected]OP
        link
        fedilink
        117 days ago

        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…

        • @[email protected]
          link
          fedilink
          19 days ago

          If the message used enums for actions/procedures like SPAM_MEMES, then using enums would be more performant

    • @[email protected]OP
      link
      fedilink
      217 days ago

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