From e823c578c9f6886fe9db9767cb81e75a6c56bf15 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 28 Nov 2019 16:00:03 +0300 Subject: Use InFile for AstId --- crates/ra_hir_def/src/attr.rs | 2 +- crates/ra_hir_def/src/lib.rs | 10 +++++----- crates/ra_hir_def/src/nameres.rs | 6 +++--- crates/ra_hir_def/src/nameres/tests/mod_resolution.rs | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'crates/ra_hir_def') diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs index 83783ac7a..346019f88 100644 --- a/crates/ra_hir_def/src/attr.rs +++ b/crates/ra_hir_def/src/attr.rs @@ -157,7 +157,7 @@ where N: ast::AttrsOwner, D: DefDatabase, { - let src = InFile::new(src.file_id(), src.to_node(db)); + let src = InFile::new(src.file_id, src.to_node(db)); Attrs::from_attrs_owner(db, src.as_ref().map(|it| it as &dyn AttrsOwner)) } diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index 9d89692bf..6daf7d3a3 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs @@ -108,7 +108,7 @@ pub trait AstItemDef: salsa::InternKey + Clone { fn source(self, db: &(impl AstDatabase + InternDatabase)) -> InFile { let loc = self.lookup_intern(db); let value = loc.ast_id.to_node(db); - InFile { file_id: loc.ast_id.file_id(), value } + InFile { file_id: loc.ast_id.file_id, value } } fn module(self, db: &impl InternDatabase) -> ModuleId { let loc = self.lookup_intern(db); @@ -525,7 +525,7 @@ impl HasSource for FunctionLoc { fn source(&self, db: &impl db::DefDatabase) -> InFile { let node = self.ast_id.to_node(db); - InFile::new(self.ast_id.file_id(), node) + InFile::new(self.ast_id.file_id, node) } } @@ -534,7 +534,7 @@ impl HasSource for TypeAliasLoc { fn source(&self, db: &impl db::DefDatabase) -> InFile { let node = self.ast_id.to_node(db); - InFile::new(self.ast_id.file_id(), node) + InFile::new(self.ast_id.file_id, node) } } @@ -543,7 +543,7 @@ impl HasSource for ConstLoc { fn source(&self, db: &impl db::DefDatabase) -> InFile { let node = self.ast_id.to_node(db); - InFile::new(self.ast_id.file_id(), node) + InFile::new(self.ast_id.file_id, node) } } @@ -552,7 +552,7 @@ impl HasSource for StaticLoc { fn source(&self, db: &impl db::DefDatabase) -> InFile { let node = self.ast_id.to_node(db); - InFile::new(self.ast_id.file_id(), node) + InFile::new(self.ast_id.file_id, node) } } diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs index 1b369ea11..df42ea84a 100644 --- a/crates/ra_hir_def/src/nameres.rs +++ b/crates/ra_hir_def/src/nameres.rs @@ -267,7 +267,7 @@ impl ModuleData { return InFile::new(file_id.into(), Either::A(sf)); } let decl = self.declaration.unwrap(); - InFile::new(decl.file_id(), Either::B(decl.to_node(db))) + InFile::new(decl.file_id, Either::B(decl.to_node(db))) } /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. @@ -275,7 +275,7 @@ impl ModuleData { pub fn declaration_source(&self, db: &impl DefDatabase) -> Option> { let decl = self.declaration?; let value = decl.to_node(db); - Some(InFile { file_id: decl.file_id(), value }) + Some(InFile { file_id: decl.file_id, value }) } } @@ -309,7 +309,7 @@ mod diagnostics { } let decl = declaration.to_node(db); sink.push(UnresolvedModule { - file: declaration.file_id(), + file: declaration.file_id, decl: AstPtr::new(&decl), candidate: candidate.clone(), }) diff --git a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs index e11530062..e800cc68e 100644 --- a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs +++ b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs @@ -668,7 +668,7 @@ fn unresolved_module_diagnostics() { module: LocalModuleId( 0, ), - declaration: AstId { + declaration: InFile { file_id: HirFileId( FileId( FileId( @@ -676,7 +676,7 @@ fn unresolved_module_diagnostics() { ), ), ), - file_ast_id: FileAstId { + value: FileAstId { raw: ErasedFileAstId( 1, ), -- cgit v1.2.3