diff options
author | Aleksey Kladov <[email protected]> | 2020-10-17 22:35:21 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-10-17 22:35:21 +0100 |
commit | 4fe4c30436986318dad339ce1ece2ae698a99303 (patch) | |
tree | 11f576a910fda7179bb66aaa7deb30b44b28af5b | |
parent | 783c6a333acc3c05839f8c4bfa3174665a32abc6 (diff) |
Improve readability
-rw-r--r-- | crates/hir_def/src/body.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/hir_def/src/body.rs b/crates/hir_def/src/body.rs index 9a9a605dd..d51036e4f 100644 --- a/crates/hir_def/src/body.rs +++ b/crates/hir_def/src/body.rs | |||
@@ -105,14 +105,16 @@ impl Expander { | |||
105 | 105 | ||
106 | let macro_call = InFile::new(self.current_file_id, ¯o_call); | 106 | let macro_call = InFile::new(self.current_file_id, ¯o_call); |
107 | 107 | ||
108 | if let Some(call_id) = macro_call.as_call_id(db, self.crate_def_map.krate, |path| { | 108 | let resolver = |path: ModPath| -> Option<MacroDefId> { |
109 | if let Some(local_scope) = local_scope { | 109 | if let Some(local_scope) = local_scope { |
110 | if let Some(def) = path.as_ident().and_then(|n| local_scope.get_legacy_macro(n)) { | 110 | if let Some(def) = path.as_ident().and_then(|n| local_scope.get_legacy_macro(n)) { |
111 | return Some(def); | 111 | return Some(def); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | self.resolve_path_as_macro(db, &path) | 114 | self.resolve_path_as_macro(db, &path) |
115 | }) { | 115 | }; |
116 | |||
117 | if let Some(call_id) = macro_call.as_call_id(db, self.crate_def_map.krate, resolver) { | ||
116 | let file_id = call_id.as_file(); | 118 | let file_id = call_id.as_file(); |
117 | if let Some(node) = db.parse_or_expand(file_id) { | 119 | if let Some(node) = db.parse_or_expand(file_id) { |
118 | if let Some(expr) = T::cast(node) { | 120 | if let Some(expr) = T::cast(node) { |