-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Minimal example
macro_rules! impl_binary_form_scalar {
($type:tt, $read:ident) => {
impl BinaryValue for $type {
fn to_bytes(&self) -> Vec<u8> {
vec![*self as u8]
}
}
};
}
This macros is invoked for
impl_binary_form_scalar! { u8, read_u8 }
and
impl_binary_form_scalar! { i8, read_i8 }
Clippy suggests to replace u8
with Self vec![*self as Self]
which in case with i8
is not possible.
Also, I can't figure out how to disable lint in this particular place because
#![cfg_attr(feature="cargo-clippy", allow(clippy::use_self))]
fn to_bytes(&self) -> Vec<u8> {
is not working.
cargo +nightly clippy -V
clippy 0.0.212 (016d92d6 2019-03-10)
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have