You can either:
-
Add an
allowattribute on a struct, module, function, etc.:#[allow(dead_code)] struct SemanticDirection; -
Add an
allowas a crate-level attribute; notice the!:#![allow(dead_code)] -
Pass it to
rustc:rustc -A dead_code main.rs -
Pass it using
cargovia theRUSTFLAGSenvironment variable:RUSTFLAGS="$RUSTFLAGS -A dead_code" cargo build