diff options
author | Kirill Bulatov <[email protected]> | 2020-05-02 20:24:27 +0100 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-05-02 20:24:27 +0100 |
commit | fee74851b02fb69c32291f3051438901faaf667f (patch) | |
tree | 0f086146c872215e7b02e091bd4a187bae83f924 /crates/ra_hir/src | |
parent | 767bff89ededdff875b042bb37397b972e3a82f1 (diff) |
Propose custom derives in completion
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index af59aa1b6..a004363ee 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -19,7 +19,7 @@ use hir_def::{ | |||
19 | use hir_expand::{ | 19 | use hir_expand::{ |
20 | diagnostics::DiagnosticSink, | 20 | diagnostics::DiagnosticSink, |
21 | name::{name, AsName}, | 21 | name::{name, AsName}, |
22 | MacroDefId, | 22 | MacroDefId, MacroDefKind, |
23 | }; | 23 | }; |
24 | use hir_ty::{ | 24 | use hir_ty::{ |
25 | autoderef, display::HirFormatter, expr::ExprValidator, method_resolution, ApplicationTy, | 25 | autoderef, display::HirFormatter, expr::ExprValidator, method_resolution, ApplicationTy, |
@@ -762,13 +762,12 @@ impl MacroDef { | |||
762 | 762 | ||
763 | /// Indicate it is a proc-macro | 763 | /// Indicate it is a proc-macro |
764 | pub fn is_proc_macro(&self) -> bool { | 764 | pub fn is_proc_macro(&self) -> bool { |
765 | match self.id.kind { | 765 | matches!(self.id.kind, MacroDefKind::CustomDerive(_)) |
766 | hir_expand::MacroDefKind::Declarative => false, | 766 | } |
767 | hir_expand::MacroDefKind::BuiltIn(_) => false, | 767 | |
768 | hir_expand::MacroDefKind::BuiltInDerive(_) => false, | 768 | /// Indicate it is a derive macro |
769 | hir_expand::MacroDefKind::BuiltInEager(_) => false, | 769 | pub fn is_derive_macro(&self) -> bool { |
770 | hir_expand::MacroDefKind::CustomDerive(_) => true, | 770 | matches!(self.id.kind, MacroDefKind::CustomDerive(_) | MacroDefKind::BuiltInDerive(_)) |
771 | } | ||
772 | } | 771 | } |
773 | } | 772 | } |
774 | 773 | ||