Reputation: 1552
What is the difference between
#[allow(dead_code)]
// ...some code
and
#[allow(unused)]
// ...some code
Upvotes: 29
Views: 1606
Reputation: 430368
dead_code
is one specific lint that is defined as:
declare_lint! {
pub DEAD_CODE,
Warn,
"detect unused, unexported items"
}
unused
is a lint group that is composed of dead_code
and many other lints. It is defined as:
add_lint_group!(
"unused",
UNUSED_IMPORTS,
UNUSED_VARIABLES,
UNUSED_ASSIGNMENTS,
DEAD_CODE,
UNUSED_MUT,
UNREACHABLE_CODE,
UNREACHABLE_PATTERNS,
OVERLAPPING_PATTERNS,
UNUSED_MUST_USE,
UNUSED_UNSAFE,
PATH_STATEMENTS,
UNUSED_ATTRIBUTES,
UNUSED_MACROS,
UNUSED_ALLOCATION,
UNUSED_DOC_COMMENTS,
UNUSED_EXTERN_CRATES,
UNUSED_FEATURES,
UNUSED_LABELS,
UNUSED_PARENS,
UNUSED_BRACES,
REDUNDANT_SEMICOLONS
);
Upvotes: 31