@@ -5,7 +5,7 @@ use std::{mem, sync::Arc};
5
5
6
6
use either:: Either ;
7
7
use hir_expand:: {
8
- ast_id_map:: { AstIdMap , FileAstId } ,
8
+ ast_id_map:: AstIdMap ,
9
9
hygiene:: Hygiene ,
10
10
name:: { name, AsName , Name } ,
11
11
AstId , ExpandError , HirFileId , InFile ,
@@ -62,22 +62,14 @@ impl<'a> LowerCtx<'a> {
62
62
& self . hygiene
63
63
}
64
64
65
- pub ( crate ) fn file_id ( & self ) -> HirFileId {
66
- self . ast_id_map . as_ref ( ) . unwrap ( ) . 0
67
- }
68
-
69
65
pub ( crate ) fn lower_path ( & self , ast : ast:: Path ) -> Option < Path > {
70
66
Path :: from_src ( ast, self )
71
67
}
72
68
73
- pub ( crate ) fn ast_id < N : AstNode > (
74
- & self ,
75
- db : & dyn DefDatabase ,
76
- item : & N ,
77
- ) -> Option < FileAstId < N > > {
78
- let ( file_id, ast_id_map) = self . ast_id_map . as_ref ( ) ?;
79
- let ast_id_map = ast_id_map. get_or_init ( || db. ast_id_map ( * file_id) ) ;
80
- Some ( ast_id_map. ast_id ( item) )
69
+ pub ( crate ) fn ast_id < N : AstNode > ( & self , db : & dyn DefDatabase , item : & N ) -> Option < AstId < N > > {
70
+ let & ( file_id, ref ast_id_map) = self . ast_id_map . as_ref ( ) ?;
71
+ let ast_id_map = ast_id_map. get_or_init ( || db. ast_id_map ( file_id) ) ;
72
+ Some ( InFile :: new ( file_id, ast_id_map. ast_id ( item) ) )
81
73
}
82
74
}
83
75
0 commit comments