I am trying to match
on a user-supplied string with this code:
use std::io;
fn main() {
let mut input = String::new();
io::stdin().read_line(&mut input).expect("Failed to read line.");
match input.as_ref(){
"test" => println!("That was test"),
_ => print!("Something's wrong"),
}
}
However, this code always prints "Something's wrong", even when I enter "test". How can I make this work as intended?