-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Reproduced on both on beta and nightly (not tested on stable since #51994 wasn't stabilized in 1.31).
#![warn(clippy::use_self)]
pub struct S(pub u16);
impl From<u8> for S {
fn from(a: u8) -> Self {
Self(a.into()) // <-- this is fine
}
}
macro_rules! a {
() => {
impl From<u16> for S {
fn from(a: u16) -> Self {
// S(a) // <-- this is fine but triggers the `clippy::use_self` warning
Self(a) // <-- ERROR E0423
// Self { 0: a } // <-- this is fine but ugly
}
}
}
}
a!();
fn main() {}
This is particularly troublesome on nightly since clippy::use_self
is recently upgraded to emit the lint in a local macro thanks to rust-lang/rust-clippy#3627, but the suggestion failed to compile.
Centril
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.