aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src/builtin_derive.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_expand/src/builtin_derive.rs')
-rw-r--r--crates/ra_hir_expand/src/builtin_derive.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs
index 574637602..d7f8ada78 100644
--- a/crates/ra_hir_expand/src/builtin_derive.rs
+++ b/crates/ra_hir_expand/src/builtin_derive.rs
@@ -12,10 +12,10 @@ use crate::db::AstDatabase;
12use crate::{name, quote, MacroCallId, MacroDefId, MacroDefKind}; 12use crate::{name, quote, MacroCallId, MacroDefId, MacroDefKind};
13 13
14macro_rules! register_builtin { 14macro_rules! register_builtin {
15 ( $(($name:ident, $kind: ident) => $expand:ident),* ) => { 15 ( $($trait:ident => $expand:ident),* ) => {
16 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 16 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
17 pub enum BuiltinDeriveExpander { 17 pub enum BuiltinDeriveExpander {
18 $($kind),* 18 $($trait),*
19 } 19 }
20 20
21 impl BuiltinDeriveExpander { 21 impl BuiltinDeriveExpander {
@@ -26,7 +26,7 @@ macro_rules! register_builtin {
26 tt: &tt::Subtree, 26 tt: &tt::Subtree,
27 ) -> Result<tt::Subtree, mbe::ExpandError> { 27 ) -> Result<tt::Subtree, mbe::ExpandError> {
28 let expander = match *self { 28 let expander = match *self {
29 $( BuiltinDeriveExpander::$kind => $expand, )* 29 $( BuiltinDeriveExpander::$trait => $expand, )*
30 }; 30 };
31 expander(db, id, tt) 31 expander(db, id, tt)
32 } 32 }
@@ -34,7 +34,7 @@ macro_rules! register_builtin {
34 34
35 pub fn find_builtin_derive(ident: &name::Name) -> Option<MacroDefId> { 35 pub fn find_builtin_derive(ident: &name::Name) -> Option<MacroDefId> {
36 let kind = match ident { 36 let kind = match ident {
37 $( id if id == &name::$name => BuiltinDeriveExpander::$kind, )* 37 $( id if id == &name::N![$trait] => BuiltinDeriveExpander::$trait, )*
38 _ => return None, 38 _ => return None,
39 }; 39 };
40 40
@@ -44,15 +44,15 @@ macro_rules! register_builtin {
44} 44}
45 45
46register_builtin! { 46register_builtin! {
47 (COPY_TRAIT, Copy) => copy_expand, 47 Copy => copy_expand,
48 (CLONE_TRAIT, Clone) => clone_expand, 48 Clone => clone_expand,
49 (DEFAULT_TRAIT, Default) => default_expand, 49 Default => default_expand,
50 (DEBUG_TRAIT, Debug) => debug_expand, 50 Debug => debug_expand,
51 (HASH_TRAIT, Hash) => hash_expand, 51 Hash => hash_expand,
52 (ORD_TRAIT, Ord) => ord_expand, 52 Ord => ord_expand,
53 (PARTIAL_ORD_TRAIT, PartialOrd) => partial_ord_expand, 53 PartialOrd => partial_ord_expand,
54 (EQ_TRAIT, Eq) => eq_expand, 54 Eq => eq_expand,
55 (PARTIAL_EQ_TRAIT, PartialEq) => partial_eq_expand 55 PartialEq => partial_eq_expand
56} 56}
57 57
58struct BasicAdtInfo { 58struct BasicAdtInfo {