Beginner question: which one of these two pieces of code are better in your opinion?

51 points mo_one

Hello, I've just begun experimenting around with Rust and I've created a very simple rock-paper-scissors program where the player plays against computer RNG. I was curious which one of these two ways to display the winner is best in your opinion and what are their pros and cons. I chose the first way because i thought it was less repetitive and more readable, though I feel like the second way might be faster, what do you think? (the botch var is the bot's choice while choice is the player's)

First way:

    if choice == botch {
        println!("Tie!");
    } else if (botch.as_str() == "rock" && choice.as_str() == "paper") || 
      (botch.as_str() == "scissors" && choice.as_str() == "rock") || 
      (botch.as_str() == "paper" && choice.as_str() == "scissors") {
        println!("Human wins!");
    } else {
        println!("Bot wins!");
    }

Second way:

  if choice == botch {
        println!("Tie!"); 
  } else {
    match botch.as_str() {
        "rock" => if choice.as_str() == "paper" {
            println!("Human wins!");
        } else {
            println!("Bot wins!");
        },
        "scissors" => if choice.as_str() == "rock" {
            println!("Human wins!");
        } else {
            println!("Bot wins!");
        },
        "paper" => if choice.as_str() == "scissors" {
            println!("Human wins!");
        } else {
            println!("Bot wins!");
        },
        _ => println!("ERROR!"),
    };
  }