From 42be05a335f21fa2d0f2225ffc29482d2c995316 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 18 Jun 2020 16:02:45 +0200 Subject: Simplify --- crates/ra_hir_def/src/nameres.rs | 7 ------- crates/ra_hir_def/src/nameres/collector.rs | 5 ++++- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs index b3e5f491a..b8560fdc9 100644 --- a/crates/ra_hir_def/src/nameres.rs +++ b/crates/ra_hir_def/src/nameres.rs @@ -119,13 +119,6 @@ impl Default for ModuleOrigin { } impl ModuleOrigin { - pub(crate) fn not_sure_file(file: Option, declaration: AstId) -> Self { - match file { - None => ModuleOrigin::Inline { definition: declaration }, - Some(definition) => ModuleOrigin::File { declaration, definition }, - } - } - fn declaration(&self) -> Option> { match self { ModuleOrigin::File { declaration: module, .. } diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 976e5e585..77baa4c69 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs @@ -825,7 +825,10 @@ impl ModCollector<'_, '_> { let modules = &mut self.def_collector.def_map.modules; let res = modules.alloc(ModuleData::default()); modules[res].parent = Some(self.module_id); - modules[res].origin = ModuleOrigin::not_sure_file(definition, declaration); + modules[res].origin = match definition { + None => ModuleOrigin::Inline { definition: declaration }, + Some(definition) => ModuleOrigin::File { declaration, definition }, + }; for (name, mac) in modules[self.module_id].scope.collect_legacy_macros() { modules[res].scope.define_legacy_macro(name, mac) } -- cgit v1.2.3