Rust – dead_code lint
Rust is a systems programming language that has some unique features which include warning if there are unused variables or unused functions. To do this, the Rust compiler provides the users with a dead code lint which warns us about unused codes, and by the usage of the #[allow(dead_code)], it eliminates any unused variables/functions error.
In this example, we have created two functions: outer_func_one() and outer_func_two(). We are calling the outer_func_one from the main method but we never use the outer_func_two. Due to this Rust compiler throws us a warning that the outer_func_two() is never used and suggests we handle warn dead code by default error.
Continuing from Example 1, handle the warn dead code by adding #[allow(dead_code)] attribute, the lints are disabled.
Please Login to comment...