exclude enum from derivable impls

This commit is contained in:
hkalbasi 2021-10-03 11:58:27 +03:30
parent da3b4b4594
commit ea8e65f0da
2 changed files with 14 additions and 0 deletions

View File

@ -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_enum();
then {
if let TyKind::Path(QPath::Resolved(_, p)) = self_ty.kind {
if let Some(PathSegment { args: Some(a), .. }) = p.segments.last() {

View File

@ -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() {}