]> git.lizzy.rs Git - rust.git/commitdiff
Improve readability
authorAleksey Kladov <aleksey.kladov@gmail.com>
Sat, 17 Oct 2020 21:35:21 +0000 (23:35 +0200)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Sat, 17 Oct 2020 21:35:21 +0000 (23:35 +0200)
crates/hir_def/src/body.rs

index 9a9a605ddb943055492a0c667329d4db4ddc6068..d51036e4f620f110164e43e174b3ccfae471be21 100644 (file)
@@ -105,14 +105,16 @@ pub(crate) fn enter_expand<T: ast::AstNode>(
 
         let macro_call = InFile::new(self.current_file_id, &macro_call);
 
-        if let Some(call_id) = macro_call.as_call_id(db, self.crate_def_map.krate, |path| {
+        let resolver = |path: ModPath| -> Option<MacroDefId> {
             if let Some(local_scope) = local_scope {
                 if let Some(def) = path.as_ident().and_then(|n| local_scope.get_legacy_macro(n)) {
                     return Some(def);
                 }
             }
             self.resolve_path_as_macro(db, &path)
-        }) {
+        };
+
+        if let Some(call_id) = macro_call.as_call_id(db, self.crate_def_map.krate, resolver) {
             let file_id = call_id.as_file();
             if let Some(node) = db.parse_or_expand(file_id) {
                 if let Some(expr) = T::cast(node) {