dead_code 和未使用的 lints 之间有什么区别?
What is the difference between the dead_code and unused lints?
有什么区别
#[allow(dead_code)]
// ...some code
和
#[allow(unused)]
// ...some code
dead_code
is one specific lint that is defined as:
declare_lint! {
pub DEAD_CODE,
Warn,
"detect unused, unexported items"
}
unused
是一个 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
);
有什么区别
#[allow(dead_code)]
// ...some code
和
#[allow(unused)]
// ...some code
dead_code
is one specific lint that is defined as:
declare_lint! {
pub DEAD_CODE,
Warn,
"detect unused, unexported items"
}
unused
是一个 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
);