How to match against a &'static str in Rust
<p>I am a Rust beginner and I can't solve this type problem. I have tried replacing <code>&amp;name</code> with <code>name</code>, but the error "pattern <code>&amp;_</code> not covered"  occurred.</p>

<pre><code>fn get_project(name: &amp;'static str) {
    match &amp;name {
        "hi" =&gt; {},
    }
}

fn main() {
    let project = get_project("hi");
}
</code></pre>

<p>Compiler error:</p>

<pre class="lang-none prettyprint-override"><code>error[E0308]: mismatched types
 --&gt; &lt;anon&gt;:3:9
  |
3 |         "hi" =&gt; {},
  |         ^^^^ expected &amp;str, found str
  |
  = note: expected type `&amp;&amp;str`
  = note:    found type `&amp;'static str`
</code></pre>