rust-playground icon indicating copy to clipboard operation
rust-playground copied to clipboard

"Test" and "Clippy" dead code warnings for code with main and tests

Open BartMassey opened this issue 5 years ago • 1 comments

In this playground

fn main() {
    println!("hello world");
}

or similar, using "Test" or "Clippy" gives dead code warnings:

   Compiling playground v0.0.1 (/playground)
warning: function is never used: `main`
 --> src/lib.rs:1:4
  |
1 | fn main() {
  |    ^^^^
  |
  = note: `#[warn(dead_code)]` on by default

    Finished test [unoptimized + debuginfo] target(s) in 0.73s

Looks like the code is put in lib.rs instead of main.rs. Pull Request #461 appears to have added support for passing the crate type to the backend, but I can't find anything in the interface to set the crate type — is it set heuristically?

BartMassey avatar Apr 03 '20 20:04 BartMassey

Github just pinged me on this for some reason. Checked on the status: Clippy works fine now, but Test still complains.

BartMassey avatar Jan 14 '23 01:01 BartMassey