1
Fork 0

Merge unused_tuple_struct_fields into dead_code

This implicitly upgrades the lint from `allow` to `warn` and places it
into the `unused` lint group.
This commit is contained in:
Jake Goulding 2023-11-26 14:48:34 -05:00
parent 2f6fc05186
commit 9fcf9c1410
3 changed files with 43 additions and 52 deletions

View file

@ -125,7 +125,6 @@ declare_lint_pass! {
UNUSED_MACROS,
UNUSED_MUT,
UNUSED_QUALIFICATIONS,
UNUSED_TUPLE_STRUCT_FIELDS,
UNUSED_UNSAFE,
UNUSED_VARIABLES,
USELESS_DEPRECATED,
@ -697,8 +696,13 @@ declare_lint! {
/// Dead code may signal a mistake or unfinished code. To silence the
/// warning for individual items, prefix the name with an underscore such
/// as `_foo`. If it was intended to expose the item outside of the crate,
/// consider adding a visibility modifier like `pub`. Otherwise consider
/// removing the unused code.
/// consider adding a visibility modifier like `pub`.
///
/// To preserve the numbering of tuple structs with unused fields,
/// change the unused fields to have unit type or use
/// `PhantomData`.
///
/// Otherwise consider removing the unused code.
pub DEAD_CODE,
Warn,
"detect unused, unexported items"
@ -732,32 +736,6 @@ declare_lint! {
"detects attributes that were not used by the compiler"
}
declare_lint! {
/// The `unused_tuple_struct_fields` lint detects fields of tuple structs
/// that are never read.
///
/// ### Example
///
/// ```rust
/// #[warn(unused_tuple_struct_fields)]
/// struct S(i32, i32, i32);
/// let s = S(1, 2, 3);
/// let _ = (s.0, s.2);
/// ```
///
/// {{produces}}
///
/// ### Explanation
///
/// Tuple struct fields that are never read anywhere may indicate a
/// mistake or unfinished code. To silence this warning, consider
/// removing the unused field(s) or, to preserve the numbering of the
/// remaining fields, change the unused field(s) to have unit type.
pub UNUSED_TUPLE_STRUCT_FIELDS,
Allow,
"detects tuple struct fields that are never read"
}
declare_lint! {
/// The `unreachable_code` lint detects unreachable code paths.
///