Skip to content

Commit 63b04f7

Browse files
committed
Auto merge of rust-lang#7755 - HKalbasi:master, r=xFrednet
exclude enum from derivable impls fix rust-lang#7753 changelog: Exclude enum from ``[`derivable_impls`]``
2 parents 33c34fb + 0ebc656 commit 63b04f7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

clippy_lints/src/derivable_impls.rs

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
8383
if !attrs.iter().any(|attr| attr.doc_str().is_some());
8484
if let child_attrs = cx.tcx.hir().attrs(impl_item_hir);
8585
if !child_attrs.iter().any(|attr| attr.doc_str().is_some());
86+
if adt_def.is_struct();
8687
then {
8788
if let TyKind::Path(QPath::Resolved(_, p)) = self_ty.kind {
8889
if let Some(PathSegment { args: Some(a), .. }) = p.segments.last() {

tests/ui/derivable_impls.rs

+13
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,17 @@ impl Default for RepeatDefault2 {
227227
}
228228
}
229229

230+
// https://github.com/rust-lang/rust-clippy/issues/7753
231+
232+
pub enum IntOrString {
233+
Int(i32),
234+
String(String),
235+
}
236+
237+
impl Default for IntOrString {
238+
fn default() -> Self {
239+
IntOrString::Int(0)
240+
}
241+
}
242+
230243
fn main() {}

0 commit comments

Comments
 (0)