<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="enum Empty {}
struct Unit;

trait Run {
    fn run() -&gt; u8;
}

impl Run for Empty {
    fn run() -&gt; u8 { 0 }
}

impl Run for Unit {
    fn run() -&gt; u8 { 1 }
}

fn main() {
    println!(&quot;{} {}&quot;, Empty::run(), Unit::run());
}"><pre class="notranslate"><span class="pl-k">enum</span> <span class="pl-smi">Empty</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>
<span class="pl-k">struct</span> <span class="pl-smi">Unit</span><span class="pl-kos">;</span>

<span class="pl-k">trait</span> <span class="pl-smi">Run</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">run</span><span class="pl-kos">(</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">u8</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">impl</span> <span class="pl-smi">Run</span> <span class="pl-k">for</span> <span class="pl-smi">Empty</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">run</span><span class="pl-kos">(</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">u8</span> <span class="pl-kos">{</span> <span class="pl-c1">0</span> <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">impl</span> <span class="pl-smi">Run</span> <span class="pl-k">for</span> <span class="pl-smi">Unit</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">run</span><span class="pl-kos">(</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">u8</span> <span class="pl-kos">{</span> <span class="pl-c1">1</span> <span class="pl-kos">}</span>
<span class="pl-kos">}</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">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{} {}"</span>, <span class="pl-v">Empty</span>::run<span class="pl-kos">(</span><span class="pl-kos">)</span>, <span class="pl-v">Unit</span>::run<span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ rustc -V
rustc 1.3.0-nightly (6d71ce536 2015-07-06)

$ rustc test.rs 
test.rs:1:1: 1:14 warning: enum is never used: `Empty`, #[warn(dead_code)] on by default
test.rs:1 enum Empty {}
          ^~~~~~~~~~~~~
test.rs:2:1: 2:13 warning: struct is never used: `Unit`, #[warn(dead_code)] on by default
test.rs:2 struct Unit;"><pre class="notranslate"><code class="notranslate">$ rustc -V
rustc 1.3.0-nightly (6d71ce536 2015-07-06)

$ rustc test.rs 
test.rs:1:1: 1:14 warning: enum is never used: `Empty`, #[warn(dead_code)] on by default
test.rs:1 enum Empty {}
          ^~~~~~~~~~~~~
test.rs:2:1: 2:13 warning: struct is never used: `Unit`, #[warn(dead_code)] on by default
test.rs:2 struct Unit;
</code></pre></div>
<p dir="auto">The same doesn't happen for static methods implemented directly on the types.</p>
<p dir="auto">foo.rs:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="trait Bar {
    fn bar() {}
}

enum Foo {}

impl Bar for Foo {}

fn main() {
    Foo::bar();
}"><pre class="notranslate"><span class="pl-k">trait</span> <span class="pl-smi">Bar</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">bar</span><span class="pl-kos">(</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">enum</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>

<span class="pl-k">impl</span> <span class="pl-smi">Bar</span> <span class="pl-k">for</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span><span class="pl-kos">}</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-smi">Foo</span><span class="pl-kos">::</span><span class="pl-en">bar</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Warning:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; rustc --version
rustc 1.0.0-nightly (199bdcfef 2015-03-26) (built 2015-03-27)
&gt; rustc foo.rs 
foo.rs:5:1: 5:12 warning: enum is never used: `Foo`, #[warn(dead_code)] on by default
foo.rs:5 enum Foo {}
         ^~~~~~~~~~~"><pre class="notranslate"><code class="notranslate">&gt; rustc --version
rustc 1.0.0-nightly (199bdcfef 2015-03-26) (built 2015-03-27)
&gt; rustc foo.rs 
foo.rs:5:1: 5:12 warning: enum is never used: `Foo`, #[warn(dead_code)] on by default
foo.rs:5 enum Foo {}
         ^~~~~~~~~~~
</code></pre></div>