4941: Simplify r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-06-18 14:05:54 +00:00 committed by GitHub
commit 1e35c74055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 8 deletions

View File

@ -119,13 +119,6 @@ impl Default for ModuleOrigin {
} }
impl ModuleOrigin { impl ModuleOrigin {
pub(crate) fn not_sure_file(file: Option<FileId>, declaration: AstId<ast::Module>) -> Self {
match file {
None => ModuleOrigin::Inline { definition: declaration },
Some(definition) => ModuleOrigin::File { declaration, definition },
}
}
fn declaration(&self) -> Option<AstId<ast::Module>> { fn declaration(&self) -> Option<AstId<ast::Module>> {
match self { match self {
ModuleOrigin::File { declaration: module, .. } ModuleOrigin::File { declaration: module, .. }

View File

@ -825,7 +825,10 @@ impl ModCollector<'_, '_> {
let modules = &mut self.def_collector.def_map.modules; let modules = &mut self.def_collector.def_map.modules;
let res = modules.alloc(ModuleData::default()); let res = modules.alloc(ModuleData::default());
modules[res].parent = Some(self.module_id); 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() { for (name, mac) in modules[self.module_id].scope.collect_legacy_macros() {
modules[res].scope.define_legacy_macro(name, mac) modules[res].scope.define_legacy_macro(name, mac)
} }