-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clippy doesn't generate large_enum_variant
warning when using bytes::Bytes
#11915
Comments
@rustbot claim |
It seems that |
pub struct Bytes {
ptr: *const u8,
len: usize,
// inlined "trait object"
data: AtomicPtr<()>,
vtable: &'static Vtable,
}
pub(crate) struct Vtable {
/// fn(data, ptr, len)
pub clone: unsafe fn(&AtomicPtr<()>, *const u8, usize) -> Bytes,
/// fn(data, ptr, len)
///
/// takes `Bytes` to value
pub to_vec: unsafe fn(&AtomicPtr<()>, *const u8, usize) -> Vec<u8>,
/// fn(data, ptr, len)
pub drop: unsafe fn(&mut AtomicPtr<()>, *const u8, usize),
} Seems that the |
I'm unsure since I'm not familiar with |
I add a simple match arm rust-clippy/clippy_utils/src/ty.rs Line 391 in a859e5c
Generally I believe I need some help :) |
@anall @flip1995 It seems that you contribute a lot at this function. It'll be a great help if you can give some suggestion. Thanks! The function is introduced 3 years ago with a FIXME.
Is the function still needed? |
I don't really contribute there. My only contributions are syncs between the rust and Clippy repo. Fastest way to get help here is to post on Zulip about this. |
Summary
If we are using
Vec
, clippy generates warning for large size difference in enum variants as expected, but if we replaceVec
withbytes::Bytes
, clippy doesn't generate any warning! Even when the size difference of enum variants is much bigger in later case!Lint Name
large_enum_variant
Reproducer
I tried this code:
I expected to see this happen:
clippy should have generated
large_enum_variant
warning for both enumsNoWarnings
( usesBytes
) &MakesClippyAngry
( usesVec
).Instead, this happened:
Clippy generates warning only for
MakesClippyAngry
, but doesn't forNoWarnings
.Version
The text was updated successfully, but these errors were encountered: