rust-lang / rust-lang/rust-playground
"Test" and "Clippy" dead code warnings for code with main and tests
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 267
- Avg merge
- 3h 2m
- Merged PRs (30d)
- 6
Description
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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the warning with the linked Rust Playground example using Test or Clippy, then inspect how the playground places code in src/lib.rs versus main.rs. Read the crate-type handling added in PR #461 and find the interface used by the backend. Done means these modes no longer report a spurious dead_code warning for a valid main function.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100