Issue
struct SemanticDirection;
fn main() {}
warning: struct is never used: `SemanticDirection`
--> src/main.rs:1:1
|
1 | struct SemanticDirection;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default
I will turn these warnings back on for anything serious, but I am just tinkering with the language and this is driving me bats.
I tried adding #[allow(dead_code)] to my code, but that did not work.
Solution
You can either:
Add an
allowattribute on a struct, module, function, etc.:#[allow(dead_code)] struct SemanticDirection;Add a crate-level
allowattribute; notice the!:#![allow(dead_code)]Pass it to
rustc:rustc -A dead_code main.rsPass it using
cargovia theRUSTFLAGSenvironment variable:RUSTFLAGS="$RUSTFLAGS -A dead_code" cargo build
Answered By - Arjan Answer Checked By - Willingham (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.