Skip to content

Commit

Permalink
Auto merge of rust-lang#7755 - HKalbasi:master, r=xFrednet
Browse files Browse the repository at this point in the history
exclude enum from derivable impls

fix rust-lang#7753

changelog: Exclude enum from ``[`derivable_impls`]``
  • Loading branch information
bors committed Oct 3, 2021
2 parents 33c34fb + 0ebc656 commit 63b04f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions clippy_lints/src/derivable_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
if !attrs.iter().any(|attr| attr.doc_str().is_some());
if let child_attrs = cx.tcx.hir().attrs(impl_item_hir);
if !child_attrs.iter().any(|attr| attr.doc_str().is_some());
if adt_def.is_struct();
then {
if let TyKind::Path(QPath::Resolved(_, p)) = self_ty.kind {
if let Some(PathSegment { args: Some(a), .. }) = p.segments.last() {
Expand Down
13 changes: 13 additions & 0 deletions tests/ui/derivable_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,17 @@ impl Default for RepeatDefault2 {
}
}

// https://github.com/rust-lang/rust-clippy/issues/7753

pub enum IntOrString {
Int(i32),
String(String),
}

impl Default for IntOrString {
fn default() -> Self {
IntOrString::Int(0)
}
}

fn main() {}

0 comments on commit 63b04f7

Please sign in to comment.