<p dir="auto">Not sure if this is somehow Cargo doing this or if it's rustc, but when I do "cargo new --bin myproject" then "cargo test", it tells me "warning: function is never used: <code class="notranslate">main</code>, #[warn(dead_code)] on by default"</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ echo 'fn main(){}' | rustc --test -
&lt;anon&gt;:1:1: 1:12 warning: code is never used: `main`, #[warn(dead_code)] on by default
&lt;anon&gt;:1 fn main(){}
         ^~~~~~~~~~~"><pre class="notranslate"><code class="notranslate">$ echo 'fn main(){}' | rustc --test -
&lt;anon&gt;:1:1: 1:12 warning: code is never used: `main`, #[warn(dead_code)] on by default
&lt;anon&gt;:1 fn main(){}
         ^~~~~~~~~~~
</code></pre></div>
<p dir="auto">I have put <code class="notranslate">#[cfg(not(test))]</code> on <code class="notranslate">main</code> a couple of times (though perhaps <code class="notranslate">#[allow(dead_code)]</code> would be better) and I have just observed another person doing it. Would it be reasonable to make the dead code lint permit <code class="notranslate">main</code> to be unused?</p>