From d755b1ebe2204b93c8ab82c6c04699a9e20921f5 Mon Sep 17 00:00:00 2001 From: mcarton Date: Mon, 15 Feb 2016 13:25:29 +0100 Subject: [PATCH] Cleanup --- src/derive.rs | 3 --- tests/compile-fail/derive.rs | 11 +++++++++++ tests/ice-666.rs | 24 ------------------------ 3 files changed, 11 insertions(+), 27 deletions(-) delete mode 100644 tests/ice-666.rs diff --git a/src/derive.rs b/src/derive.rs index 7cb85b8c9..7110cf714 100644 --- a/src/derive.rs +++ b/src/derive.rs @@ -71,12 +71,9 @@ impl LintPass for Derive { impl LateLintPass for Derive { fn check_item(&mut self, cx: &LateContext, item: &Item) { - - if_let_chain! {[ let ItemImpl(_, _, _, Some(ref trait_ref), _, _) = item.node ], { - let ty = cx.tcx.lookup_item_type(cx.tcx.map.local_def_id(item.id)).ty; if item.attrs.iter().any(is_automatically_derived) { check_hash_peq(cx, item.span, trait_ref, ty); diff --git a/tests/compile-fail/derive.rs b/tests/compile-fail/derive.rs index 66b04a66d..14b1106ad 100755 --- a/tests/compile-fail/derive.rs +++ b/tests/compile-fail/derive.rs @@ -35,6 +35,17 @@ impl Clone for Qux { fn clone(&self) -> Self { Qux } } +// See #666 +#[derive(Copy)] +struct Lt<'a> { + a: &'a u8, +} + +impl<'a> Clone for Lt<'a> { +//~^ ERROR you are implementing `Clone` explicitly on a `Copy` type + fn clone(&self) -> Self { unimplemented!() } +} + // Ok, `Clone` cannot be derived because of the big array #[derive(Copy)] struct BigArray { diff --git a/tests/ice-666.rs b/tests/ice-666.rs deleted file mode 100644 index b681f4b2c..000000000 --- a/tests/ice-666.rs +++ /dev/null @@ -1,24 +0,0 @@ -#![feature(plugin)] -#![plugin(clippy)] - -pub struct Lt<'a> { - _foo: &'a u8, -} - -impl<'a> Copy for Lt<'a> {} -impl<'a> Clone for Lt<'a> { - fn clone(&self) -> Lt<'a> { - unimplemented!(); - } -} - -pub struct Ty { - _foo: A, -} - -impl Copy for Ty {} -impl Clone for Ty { - fn clone(&self) -> Ty { - unimplemented!(); - } -}