mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Use original_file
instead of as_original_file
This commit is contained in:
parent
3b4c506f33
commit
04741ae2bc
2 changed files with 4 additions and 4 deletions
|
@ -119,7 +119,7 @@ impl NavigationTarget {
|
||||||
|
|
||||||
pub(crate) fn from_module(db: &RootDatabase, module: hir::Module) -> NavigationTarget {
|
pub(crate) fn from_module(db: &RootDatabase, module: hir::Module) -> NavigationTarget {
|
||||||
let src = module.definition_source(db);
|
let src = module.definition_source(db);
|
||||||
let file_id = src.file_id.as_original_file();
|
let file_id = src.file_id.original_file(db);
|
||||||
let name = module.name(db).map(|it| it.to_string().into()).unwrap_or_default();
|
let name = module.name(db).map(|it| it.to_string().into()).unwrap_or_default();
|
||||||
match src.ast {
|
match src.ast {
|
||||||
ModuleSource::SourceFile(node) => {
|
ModuleSource::SourceFile(node) => {
|
||||||
|
@ -139,7 +139,7 @@ impl NavigationTarget {
|
||||||
pub(crate) fn from_module_to_decl(db: &RootDatabase, module: hir::Module) -> NavigationTarget {
|
pub(crate) fn from_module_to_decl(db: &RootDatabase, module: hir::Module) -> NavigationTarget {
|
||||||
let name = module.name(db).map(|it| it.to_string().into()).unwrap_or_default();
|
let name = module.name(db).map(|it| it.to_string().into()).unwrap_or_default();
|
||||||
if let Some(src) = module.declaration_source(db) {
|
if let Some(src) = module.declaration_source(db) {
|
||||||
let file_id = src.file_id.as_original_file();
|
let file_id = src.file_id.original_file(db);
|
||||||
return NavigationTarget::from_syntax(
|
return NavigationTarget::from_syntax(
|
||||||
file_id,
|
file_id,
|
||||||
name,
|
name,
|
||||||
|
@ -213,7 +213,7 @@ impl NavigationTarget {
|
||||||
) -> NavigationTarget {
|
) -> NavigationTarget {
|
||||||
let src = impl_block.source(db);
|
let src = impl_block.source(db);
|
||||||
NavigationTarget::from_syntax(
|
NavigationTarget::from_syntax(
|
||||||
src.file_id.as_original_file(),
|
src.file_id.original_file(db),
|
||||||
"impl".into(),
|
"impl".into(),
|
||||||
None,
|
None,
|
||||||
src.ast.syntax(),
|
src.ast.syntax(),
|
||||||
|
|
|
@ -140,7 +140,7 @@ fn rename_mod(
|
||||||
let module_src = hir::Source { file_id: position.file_id.into(), ast: ast_module.clone() };
|
let module_src = hir::Source { file_id: position.file_id.into(), ast: ast_module.clone() };
|
||||||
if let Some(module) = hir::Module::from_declaration(db, module_src) {
|
if let Some(module) = hir::Module::from_declaration(db, module_src) {
|
||||||
let src = module.definition_source(db);
|
let src = module.definition_source(db);
|
||||||
let file_id = src.file_id.as_original_file();
|
let file_id = src.file_id.original_file(db);
|
||||||
match src.ast {
|
match src.ast {
|
||||||
ModuleSource::SourceFile(..) => {
|
ModuleSource::SourceFile(..) => {
|
||||||
let mod_path: RelativePathBuf = db.file_relative_path(file_id);
|
let mod_path: RelativePathBuf = db.file_relative_path(file_id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue