How to disable unused code warnings in Rust?

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.

8 Answers
8

Leave a Comment