]> git.lizzy.rs Git - rust.git/commitdiff
expand: simplify classify_*
authorMazdak Farrokhzad <twingoow@gmail.com>
Tue, 31 Dec 2019 08:11:59 +0000 (09:11 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Thu, 13 Feb 2020 10:25:33 +0000 (11:25 +0100)
src/librustc_expand/expand.rs

index 136cc1d94a07860e2e5b33cd114b0a2d9c8dff60..91195d379d71c2b422c7c24e8f30e623103a3b8b 100644 (file)
@@ -1041,13 +1041,10 @@ fn find_attr_invoc(
     }
 
     /// If `item` is an attr invocation, remove and return the macro attribute and derive traits.
-    fn classify_item<T>(
+    fn classify_item(
         &mut self,
-        item: &mut T,
-    ) -> (Option<ast::Attribute>, Vec<Path>, /* after_derive */ bool)
-    where
-        T: HasAttrs,
-    {
+        item: &mut impl HasAttrs,
+    ) -> (Option<ast::Attribute>, Vec<Path>, /* after_derive */ bool) {
         let (mut attr, mut traits, mut after_derive) = (None, Vec::new(), false);
 
         item.visit_attrs(|mut attrs| {
@@ -1061,9 +1058,9 @@ fn classify_item<T>(
     /// Alternative to `classify_item()` that ignores `#[derive]` so invocations fallthrough
     /// to the unused-attributes lint (making it an error on statements and expressions
     /// is a breaking change)
-    fn classify_nonitem<T: HasAttrs>(
+    fn classify_nonitem(
         &mut self,
-        nonitem: &mut T,
+        nonitem: &mut impl HasAttrs,
     ) -> (Option<ast::Attribute>, /* after_derive */ bool) {
         let (mut attr, mut after_derive) = (None, false);