title: How to allow dead_code and unused_imports for dev builds only?
body: <p>The unused imports and dead code warnings are the most common that I've found while learning Rust, and they get annoying after awhile (a very short while, like a few seconds). Especially when they are mixed with compiler errors, because it makes the console difficult to read.</p>
  
  <p>I was able to turn off these warnings:</p>
  
  <pre class="lang-rust prettyprint-override"><code>#![allow(unused_imports)]
  #![allow(dead_code)]
  </code></pre>
  
  <p>This will disable the warnings for all builds, but I want the warnings enabled for release builds.</p>
  
  <p>I tried disabling them like this:</p>
  
  <pre class="lang-rust prettyprint-override"><code>#![cfg(dev)]
  #![allow(unused_imports)]
  #![allow(dead_code)]
  </code></pre>
  
  <p>But, this removed the entire Rust file from release builds (not what I want).</p>
  
  <p>I tried to configure using <code>cfg_attr</code> but it had no effect for either builds.</p>
  
  <pre class="lang-rust prettyprint-override"><code>#![cfg_attr(dev, allow(unused_imports))]
  #![cfg_attr(dev, allow(dead_code))]
  </code></pre>
  
  <p>I have Googled and read all the related questions on StackOverflow but can't figure this out.</p>