From 042aff12b37504eba0c1f99a9b976fbd10ec2f4d Mon Sep 17 00:00:00 2001 From: lakshay bhatia Date: Thu, 10 Jul 2025 19:31:15 +0530 Subject: [PATCH 1/8] Fixed issue Fixed issue by adding checks for no_std whild giving out Box recommendation --- clippy_lints/src/large_enum_variant.rs | 20 ++++++++++++++------ tests/ui/large_enum_variant_no_std.rs | 15 +++++++++++++++ tests/ui/large_enum_variant_no_std.stderr | 16 ++++++++++++++++ 3 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 tests/ui/large_enum_variant_no_std.rs create mode 100644 tests/ui/large_enum_variant_no_std.stderr diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs index e85d779b4880..764282bc64ee 100644 --- a/clippy_lints/src/large_enum_variant.rs +++ b/clippy_lints/src/large_enum_variant.rs @@ -8,6 +8,9 @@ use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::ty::{self, Ty}; use rustc_session::impl_lint_pass; use rustc_span::Span; +use clippy_utils::is_no_std_crate; + + declare_clippy_lint! { /// ### What it does @@ -117,8 +120,9 @@ impl<'tcx> LateLintPass<'tcx> for LargeEnumVariant { ident.span, "boxing a variant would require the type no longer be `Copy`", ); - } else { - let sugg: Vec<(Span, String)> = variants_size[0] + } else if !is_no_std_crate(cx) { + + let sugg: Vec<(Span, String)> = variants_size[0] .fields_size .iter() .rev() @@ -144,12 +148,16 @@ impl<'tcx> LateLintPass<'tcx> for LargeEnumVariant { }) .collect(); - if !sugg.is_empty() { - diag.multipart_suggestion(help_text, sugg, Applicability::MaybeIncorrect); - return; + if !sugg.is_empty() { + diag.multipart_suggestion(help_text, sugg, Applicability::MaybeIncorrect); + return; + } } + + if !is_no_std_crate(cx) { + diag.span_help(def.variants[variants_size[0].ind].span, help_text); } - diag.span_help(def.variants[variants_size[0].ind].span, help_text); + }, ); } diff --git a/tests/ui/large_enum_variant_no_std.rs b/tests/ui/large_enum_variant_no_std.rs new file mode 100644 index 000000000000..01d584b9d685 --- /dev/null +++ b/tests/ui/large_enum_variant_no_std.rs @@ -0,0 +1,15 @@ +#![no_std] +#![no_main] +#![warn(clippy::large_enum_variant)] + +use core::panic::PanicInfo; + +#[panic_handler] +fn panic(_: &PanicInfo) -> ! { + loop {} +} + +enum Myenum { //~ ERROR: large size difference between variants + Small(u8), + Large([u8;1024]), +} diff --git a/tests/ui/large_enum_variant_no_std.stderr b/tests/ui/large_enum_variant_no_std.stderr new file mode 100644 index 000000000000..d3ff94089c0c --- /dev/null +++ b/tests/ui/large_enum_variant_no_std.stderr @@ -0,0 +1,16 @@ +error: large size difference between variants + --> tests/ui/large_enum_variant_no_std.rs:12:1 + | +LL | / enum Myenum { +LL | | Small(u8), + | | --------- the second-largest variant contains at least 1 bytes +LL | | Large([u8;1024]), + | | ---------------- the largest variant contains at least 1024 bytes +LL | | } + | |_^ the entire enum is at least 1025 bytes + | + = note: `-D clippy::large-enum-variant` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::large_enum_variant)]` + +error: aborting due to 1 previous error + From 4c8e97d8e7969ef42681f285b01507c2642a2957 Mon Sep 17 00:00:00 2001 From: lakshay bhatia Date: Thu, 10 Jul 2025 19:47:29 +0530 Subject: [PATCH 2/8] Formatting fixed --- clippy_lints/src/large_enum_variant.rs | 18 +++++++----------- tests/ui/large_enum_variant_no_std.rs | 7 ++++--- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs index 764282bc64ee..04ffefd127be 100644 --- a/clippy_lints/src/large_enum_variant.rs +++ b/clippy_lints/src/large_enum_variant.rs @@ -1,5 +1,6 @@ use clippy_config::Conf; use clippy_utils::diagnostics::span_lint_and_then; +use clippy_utils::is_no_std_crate; use clippy_utils::source::snippet_with_applicability; use clippy_utils::ty::{AdtVariantInfo, approx_ty_size, is_copy}; use rustc_errors::Applicability; @@ -8,9 +9,6 @@ use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::ty::{self, Ty}; use rustc_session::impl_lint_pass; use rustc_span::Span; -use clippy_utils::is_no_std_crate; - - declare_clippy_lint! { /// ### What it does @@ -121,8 +119,7 @@ impl<'tcx> LateLintPass<'tcx> for LargeEnumVariant { "boxing a variant would require the type no longer be `Copy`", ); } else if !is_no_std_crate(cx) { - - let sugg: Vec<(Span, String)> = variants_size[0] + let sugg: Vec<(Span, String)> = variants_size[0] .fields_size .iter() .rev() @@ -148,16 +145,15 @@ impl<'tcx> LateLintPass<'tcx> for LargeEnumVariant { }) .collect(); - if !sugg.is_empty() { - diag.multipart_suggestion(help_text, sugg, Applicability::MaybeIncorrect); - return; - } + if !sugg.is_empty() { + diag.multipart_suggestion(help_text, sugg, Applicability::MaybeIncorrect); + return; } - + } + if !is_no_std_crate(cx) { diag.span_help(def.variants[variants_size[0].ind].span, help_text); } - }, ); } diff --git a/tests/ui/large_enum_variant_no_std.rs b/tests/ui/large_enum_variant_no_std.rs index 01d584b9d685..85f64a240955 100644 --- a/tests/ui/large_enum_variant_no_std.rs +++ b/tests/ui/large_enum_variant_no_std.rs @@ -9,7 +9,8 @@ fn panic(_: &PanicInfo) -> ! { loop {} } -enum Myenum { //~ ERROR: large size difference between variants +enum Myenum { + //~ ERROR: large size difference between variants Small(u8), - Large([u8;1024]), -} + Large([u8; 1024]), +} From 325788419fbb5d2b1aa190a3b14dd674219583c6 Mon Sep 17 00:00:00 2001 From: lakshay bhatia Date: Thu, 10 Jul 2025 19:58:32 +0530 Subject: [PATCH 3/8] Fixed Failing job checks --- tests/ui/large_enum_variant_no_std.rs | 2 +- tests/ui/large_enum_variant_no_std.stderr | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/ui/large_enum_variant_no_std.rs b/tests/ui/large_enum_variant_no_std.rs index 85f64a240955..960e5753ab91 100644 --- a/tests/ui/large_enum_variant_no_std.rs +++ b/tests/ui/large_enum_variant_no_std.rs @@ -10,7 +10,7 @@ fn panic(_: &PanicInfo) -> ! { } enum Myenum { - //~ ERROR: large size difference between variants + //~^ ERROR: large size difference between variants Small(u8), Large([u8; 1024]), } diff --git a/tests/ui/large_enum_variant_no_std.stderr b/tests/ui/large_enum_variant_no_std.stderr index d3ff94089c0c..97001c70dbe5 100644 --- a/tests/ui/large_enum_variant_no_std.stderr +++ b/tests/ui/large_enum_variant_no_std.stderr @@ -2,11 +2,12 @@ error: large size difference between variants --> tests/ui/large_enum_variant_no_std.rs:12:1 | LL | / enum Myenum { +LL | | LL | | Small(u8), | | --------- the second-largest variant contains at least 1 bytes -LL | | Large([u8;1024]), - | | ---------------- the largest variant contains at least 1024 bytes -LL | | } +LL | | Large([u8; 1024]), + | | ----------------- the largest variant contains at least 1024 bytes +LL | | } | |_^ the entire enum is at least 1025 bytes | = note: `-D clippy::large-enum-variant` implied by `-D warnings` From 0ac806d6dcf10316e8eec7b35ccc0ca7c91c4eb8 Mon Sep 17 00:00:00 2001 From: lakshay bhatia Date: Fri, 11 Jul 2025 08:53:26 +0530 Subject: [PATCH 4/8] Updated Help message --- clippy_lints/src/large_enum_variant.rs | 7 +--- .../enum_variant_size.stderr | 2 +- tests/ui/large_enum_variant.64bit.stderr | 40 +++++++++---------- tests/ui/large_enum_variant_no_std.rs | 7 ---- tests/ui/large_enum_variant_no_std.stderr | 7 +++- 5 files changed, 29 insertions(+), 34 deletions(-) diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs index 04ffefd127be..c2b739431060 100644 --- a/clippy_lints/src/large_enum_variant.rs +++ b/clippy_lints/src/large_enum_variant.rs @@ -84,7 +84,7 @@ impl<'tcx> LateLintPass<'tcx> for LargeEnumVariant { let mut difference = variants_size[0].size - variants_size[1].size; if difference > self.maximum_size_difference_allowed { - let help_text = "consider boxing the large fields to reduce the total size of the enum"; + let help_text = "consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum"; span_lint_and_then( cx, LARGE_ENUM_VARIANT, @@ -150,10 +150,7 @@ impl<'tcx> LateLintPass<'tcx> for LargeEnumVariant { return; } } - - if !is_no_std_crate(cx) { - diag.span_help(def.variants[variants_size[0].ind].span, help_text); - } + diag.span_help(def.variants[variants_size[0].ind].span, help_text); }, ); } diff --git a/tests/ui-toml/enum_variant_size/enum_variant_size.stderr b/tests/ui-toml/enum_variant_size/enum_variant_size.stderr index 020b3cc78782..a5dfd7015a39 100644 --- a/tests/ui-toml/enum_variant_size/enum_variant_size.stderr +++ b/tests/ui-toml/enum_variant_size/enum_variant_size.stderr @@ -12,7 +12,7 @@ LL | | } | = note: `-D clippy::large-enum-variant` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::large_enum_variant)]` -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - B([u8; 501]), LL + B(Box<[u8; 501]>), diff --git a/tests/ui/large_enum_variant.64bit.stderr b/tests/ui/large_enum_variant.64bit.stderr index 559bdf2a2f50..d8199f9090f6 100644 --- a/tests/ui/large_enum_variant.64bit.stderr +++ b/tests/ui/large_enum_variant.64bit.stderr @@ -12,7 +12,7 @@ LL | | } | = note: `-D clippy::large-enum-variant` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::large_enum_variant)]` -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - B([i32; 8000]), LL + B(Box<[i32; 8000]>), @@ -30,7 +30,7 @@ LL | | ContainingLargeEnum(LargeEnum), LL | | } | |_^ the entire enum is at least 32004 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - ContainingLargeEnum(LargeEnum), LL + ContainingLargeEnum(Box), @@ -49,7 +49,7 @@ LL | | StructLikeLittle { x: i32, y: i32 }, LL | | } | |_^ the entire enum is at least 70008 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), LL + ContainingMoreThanOneField(i32, Box<[i32; 8000]>, Box<[i32; 9500]>), @@ -67,7 +67,7 @@ LL | | StructLikeLarge { x: [i32; 8000], y: i32 }, LL | | } | |_^ the entire enum is at least 32008 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - StructLikeLarge { x: [i32; 8000], y: i32 }, LL + StructLikeLarge { x: Box<[i32; 8000]>, y: i32 }, @@ -85,7 +85,7 @@ LL | | StructLikeLarge2 { x: [i32; 8000] }, LL | | } | |_^ the entire enum is at least 32004 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - StructLikeLarge2 { x: [i32; 8000] }, LL + StructLikeLarge2 { x: Box<[i32; 8000]> }, @@ -104,7 +104,7 @@ LL | | C([u8; 200]), LL | | } | |_^ the entire enum is at least 1256 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - B([u8; 1255]), LL + B(Box<[u8; 1255]>), @@ -122,7 +122,7 @@ LL | | ContainingMoreThanOneField([i32; 8000], [i32; 2], [i32; 9500], [i32; LL | | } | |_^ the entire enum is at least 70132 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - ContainingMoreThanOneField([i32; 8000], [i32; 2], [i32; 9500], [i32; 30]), LL + ContainingMoreThanOneField(Box<[i32; 8000]>, [i32; 2], Box<[i32; 9500]>, [i32; 30]), @@ -140,7 +140,7 @@ LL | | B(Struct2), LL | | } | |_^ the entire enum is at least 32004 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - B(Struct2), LL + B(Box), @@ -158,7 +158,7 @@ LL | | B(Struct2), LL | | } | |_^ the entire enum is at least 32000 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - B(Struct2), LL + B(Box), @@ -176,7 +176,7 @@ LL | | B(Struct2), LL | | } | |_^ the entire enum is at least 32000 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - B(Struct2), LL + B(Box), @@ -199,7 +199,7 @@ note: boxing a variant would require the type no longer be `Copy` | LL | enum CopyableLargeEnum { | ^^^^^^^^^^^^^^^^^ -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum --> tests/ui/large_enum_variant.rs:118:5 | LL | B([u64; 8000]), @@ -222,7 +222,7 @@ note: boxing a variant would require the type no longer be `Copy` | LL | enum ManuallyCopyLargeEnum { | ^^^^^^^^^^^^^^^^^^^^^ -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum --> tests/ui/large_enum_variant.rs:124:5 | LL | B([u64; 8000]), @@ -245,7 +245,7 @@ note: boxing a variant would require the type no longer be `Copy` | LL | enum SomeGenericPossiblyCopyEnum { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum --> tests/ui/large_enum_variant.rs:138:5 | LL | B([u64; 4000]), @@ -263,7 +263,7 @@ LL | | Large((T, [u8; 512])), LL | | } | |_^ the entire enum is at least 512 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - Large((T, [u8; 512])), LL + Large(Box<(T, [u8; 512])>), @@ -281,7 +281,7 @@ LL | | Small(u8), LL | | } | |_^ the entire enum is at least 520 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - Large([Foo; 64]), LL + Large(Box<[Foo; 64]>), @@ -299,7 +299,7 @@ LL | | Error(PossiblyLargeEnumWithConst<256>), LL | | } | |_^ the entire enum is at least 514 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - Error(PossiblyLargeEnumWithConst<256>), LL + Error(Box>), @@ -317,7 +317,7 @@ LL | | Recursive(Box), LL | | } | |_^ the entire enum is at least 520 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - Large([u64; 64]), LL + Large(Box<[u64; 64]>), @@ -335,7 +335,7 @@ LL | | Error(WithRecursionAndGenerics), LL | | } | |_^ the entire enum is at least 520 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - Error(WithRecursionAndGenerics), LL + Error(Box>), @@ -353,7 +353,7 @@ LL | | _SmallBoi(u8), LL | | } | |_____^ the entire enum is at least 296 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - BigBoi(PublishWithBytes), LL + BigBoi(Box), @@ -371,7 +371,7 @@ LL | | _SmallBoi(u8), LL | | } | |_____^ the entire enum is at least 224 bytes | -help: consider boxing the large fields to reduce the total size of the enum +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | LL - BigBoi(PublishWithVec), LL + BigBoi(Box), diff --git a/tests/ui/large_enum_variant_no_std.rs b/tests/ui/large_enum_variant_no_std.rs index 960e5753ab91..656e236e49d0 100644 --- a/tests/ui/large_enum_variant_no_std.rs +++ b/tests/ui/large_enum_variant_no_std.rs @@ -1,13 +1,6 @@ #![no_std] -#![no_main] #![warn(clippy::large_enum_variant)] -use core::panic::PanicInfo; - -#[panic_handler] -fn panic(_: &PanicInfo) -> ! { - loop {} -} enum Myenum { //~^ ERROR: large size difference between variants diff --git a/tests/ui/large_enum_variant_no_std.stderr b/tests/ui/large_enum_variant_no_std.stderr index 97001c70dbe5..962f1b2ae7d6 100644 --- a/tests/ui/large_enum_variant_no_std.stderr +++ b/tests/ui/large_enum_variant_no_std.stderr @@ -1,5 +1,5 @@ error: large size difference between variants - --> tests/ui/large_enum_variant_no_std.rs:12:1 + --> tests/ui/large_enum_variant_no_std.rs:5:1 | LL | / enum Myenum { LL | | @@ -10,6 +10,11 @@ LL | | Large([u8; 1024]), LL | | } | |_^ the entire enum is at least 1025 bytes | +help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum + --> tests/ui/large_enum_variant_no_std.rs:8:5 + | +LL | Large([u8; 1024]), + | ^^^^^^^^^^^^^^^^^ = note: `-D clippy::large-enum-variant` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::large_enum_variant)]` From 4fc7109b2d844166bf9a1d3b4377c2a4939d5f47 Mon Sep 17 00:00:00 2001 From: lakshay bhatia Date: Fri, 11 Jul 2025 08:55:42 +0530 Subject: [PATCH 5/8] Fixed Job Checks (Format) --- tests/ui/large_enum_variant_no_std.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/ui/large_enum_variant_no_std.rs b/tests/ui/large_enum_variant_no_std.rs index 656e236e49d0..ff0213155b6c 100644 --- a/tests/ui/large_enum_variant_no_std.rs +++ b/tests/ui/large_enum_variant_no_std.rs @@ -1,7 +1,6 @@ #![no_std] #![warn(clippy::large_enum_variant)] - enum Myenum { //~^ ERROR: large size difference between variants Small(u8), From b8f5a9d6a839fcfa97c0f056dbc3330ccf5e62a8 Mon Sep 17 00:00:00 2001 From: lakshay bhatia Date: Fri, 11 Jul 2025 09:01:06 +0530 Subject: [PATCH 6/8] Job Checks Fixed --- tests/ui/large_enum_variant_no_std.stderr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ui/large_enum_variant_no_std.stderr b/tests/ui/large_enum_variant_no_std.stderr index 962f1b2ae7d6..4f32e3e4835f 100644 --- a/tests/ui/large_enum_variant_no_std.stderr +++ b/tests/ui/large_enum_variant_no_std.stderr @@ -1,5 +1,5 @@ error: large size difference between variants - --> tests/ui/large_enum_variant_no_std.rs:5:1 + --> tests/ui/large_enum_variant_no_std.rs:4:1 | LL | / enum Myenum { LL | | @@ -11,7 +11,7 @@ LL | | } | |_^ the entire enum is at least 1025 bytes | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum - --> tests/ui/large_enum_variant_no_std.rs:8:5 + --> tests/ui/large_enum_variant_no_std.rs:7:5 | LL | Large([u8; 1024]), | ^^^^^^^^^^^^^^^^^ From 3e6d5759b99c27b26a6429b9bfa3143662a0535b Mon Sep 17 00:00:00 2001 From: lakshay bhatia Date: Thu, 10 Jul 2025 19:31:15 +0530 Subject: [PATCH 7/8] Fixed issue with large_enum_variant in no_std Fixed issue by adding checks for no_std whild giving out Box recommendation --- clippy_lints/src/large_enum_variant.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs index c2b739431060..0b0bc6fedc68 100644 --- a/clippy_lints/src/large_enum_variant.rs +++ b/clippy_lints/src/large_enum_variant.rs @@ -10,6 +10,9 @@ use rustc_middle::ty::{self, Ty}; use rustc_session::impl_lint_pass; use rustc_span::Span; + + + declare_clippy_lint! { /// ### What it does /// Checks for large size differences between variants on @@ -150,7 +153,10 @@ impl<'tcx> LateLintPass<'tcx> for LargeEnumVariant { return; } } - diag.span_help(def.variants[variants_size[0].ind].span, help_text); + if !is_no_std_crate(cx) { + diag.span_help(def.variants[variants_size[0].ind].span, help_text); + } + }, ); } From 2614a31a03afdca27ed4de3de33f4cbe37a8b273 Mon Sep 17 00:00:00 2001 From: lakshay bhatia Date: Mon, 14 Jul 2025 14:26:00 +0530 Subject: [PATCH 8/8] formatted --- clippy_lints/src/large_enum_variant.rs | 4 ---- tests/ui/large_enum_variant_no_std.stderr | 5 ----- 2 files changed, 9 deletions(-) diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs index 0b0bc6fedc68..cc62c6447a77 100644 --- a/clippy_lints/src/large_enum_variant.rs +++ b/clippy_lints/src/large_enum_variant.rs @@ -10,9 +10,6 @@ use rustc_middle::ty::{self, Ty}; use rustc_session::impl_lint_pass; use rustc_span::Span; - - - declare_clippy_lint! { /// ### What it does /// Checks for large size differences between variants on @@ -156,7 +153,6 @@ impl<'tcx> LateLintPass<'tcx> for LargeEnumVariant { if !is_no_std_crate(cx) { diag.span_help(def.variants[variants_size[0].ind].span, help_text); } - }, ); } diff --git a/tests/ui/large_enum_variant_no_std.stderr b/tests/ui/large_enum_variant_no_std.stderr index 4f32e3e4835f..b9c58bd90f54 100644 --- a/tests/ui/large_enum_variant_no_std.stderr +++ b/tests/ui/large_enum_variant_no_std.stderr @@ -10,11 +10,6 @@ LL | | Large([u8; 1024]), LL | | } | |_^ the entire enum is at least 1025 bytes | -help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum - --> tests/ui/large_enum_variant_no_std.rs:7:5 - | -LL | Large([u8; 1024]), - | ^^^^^^^^^^^^^^^^^ = note: `-D clippy::large-enum-variant` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::large_enum_variant)]`