Categories
Programming

RUST: non-exhaustive patterns: `&_` not covered pattern `&_` not covered21 sec read

Tried something like this

let a = "hello";

match a{
    "hello"=>{println!("hello")}
}

Error

non-exhaustive patterns: `&_` not covered pattern `&_` not covered

What I thought was wrong

I thought it meant you cannot match references

What the real error was

Just had to add all possibilities in match statement

let a = "hello";

match a {
    "hello" => println!("helloooooo"),
    _ => println!("blahh blahhh"),
}