File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -154,11 +154,8 @@ impl Diagnostic for MissingOkInTailExpr {
154
154
fn message ( & self ) -> String {
155
155
"wrap return expression in Ok" . to_string ( )
156
156
}
157
- fn file ( & self ) -> HirFileId {
158
- self . file
159
- }
160
- fn syntax_node_ptr ( & self ) -> SyntaxNodePtr {
161
- self . expr . into ( )
157
+ fn source ( & self ) -> Source < SyntaxNodePtr > {
158
+ Source { file_id : self . file , ast : self . expr . into ( ) }
162
159
}
163
160
fn as_any ( & self ) -> & ( dyn Any + Send + ' static ) {
164
161
self
@@ -169,8 +166,8 @@ impl AstDiagnostic for MissingOkInTailExpr {
169
166
type AST = ast:: Expr ;
170
167
171
168
fn ast ( & self , db : & impl HirDatabase ) -> Self :: AST {
172
- let root = db. parse_or_expand ( self . file ( ) ) . unwrap ( ) ;
173
- let node = self . syntax_node_ptr ( ) . to_node ( & root) ;
169
+ let root = db. parse_or_expand ( self . file ) . unwrap ( ) ;
170
+ let node = self . source ( ) . ast . to_node ( & root) ;
174
171
ast:: Expr :: cast ( node) . unwrap ( )
175
172
}
176
173
}
You can’t perform that action at this time.
0 commit comments