<p dir="auto">I was playing with passing around a trait that only has static methods. It works okay, but it appears that this confuses the dead code lint. Here's an example:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="trait Visitor&lt;R&gt; {
    fn foo();
}

fn visit&lt;V: Visitor&lt;R&gt;, R&gt;() {
    Visitor::&lt;R&gt;::foo()
}

struct V;

impl Visitor&lt;()&gt; for V {
    fn foo() { println!(&quot;hi&quot;) }
}

pub fn main() {
    visit()
}"><pre class="notranslate"><span class="pl-k">trait</span> <span class="pl-smi">Visitor</span><span class="pl-kos">&lt;</span><span class="pl-smi">R</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">fn</span> <span class="pl-en">visit</span><span class="pl-kos">&lt;</span><span class="pl-smi">V</span><span class="pl-kos">:</span> <span class="pl-smi">Visitor</span><span class="pl-kos">&lt;</span><span class="pl-smi">R</span><span class="pl-kos">&gt;</span><span class="pl-kos">,</span> <span class="pl-smi">R</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-smi">Visitor</span><span class="pl-kos">::</span><span class="pl-kos">&lt;</span><span class="pl-smi">R</span><span class="pl-kos">&gt;</span><span class="pl-kos">::</span><span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span>

<span class="pl-k">struct</span> <span class="pl-smi">V</span><span class="pl-kos">;</span>

<span class="pl-k">impl</span> <span class="pl-smi">Visitor</span><span class="pl-kos">&lt;</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">&gt;</span> <span class="pl-k">for</span> <span class="pl-smi">V</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"hi"</span><span class="pl-kos">)</span> <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-en">visit</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Which warns with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="serde2.rs:9:1: 9:10 warning: struct is never used: `V`, #[warn(dead_code)] on by default
serde2.rs:9 struct V;
            ^~~~~~~~~"><pre class="notranslate"><code class="notranslate">serde2.rs:9:1: 9:10 warning: struct is never used: `V`, #[warn(dead_code)] on by default
serde2.rs:9 struct V;
            ^~~~~~~~~
</code></pre></div>
<p dir="auto">As best as I can tell, Rust is able to infer that there's only one implementation possible and uses it, but this information isn't conveyed to the lint, so it marks the struct as being unused.</p>