@@ -147,7 +147,7 @@ fn hover_simple(
147
147
if let Some ( doc_comment) = token_as_doc_comment ( & original_token) {
148
148
cov_mark:: hit!( no_highlight_on_comment_hover) ;
149
149
return doc_comment. get_definition_with_descend_at ( sema, offset, |def, node, range| {
150
- let res = hover_for_definition ( sema, file_id, def, & node, config) ? ;
150
+ let res = hover_for_definition ( sema, file_id, def, & node, config) ;
151
151
Some ( RangeInfo :: new ( range, res) )
152
152
} ) ;
153
153
}
@@ -161,7 +161,7 @@ fn hover_simple(
161
161
Definition :: from ( resolution?) ,
162
162
& original_token. parent ( ) ?,
163
163
config,
164
- ) ? ;
164
+ ) ;
165
165
return Some ( RangeInfo :: new ( range, res) ) ;
166
166
}
167
167
@@ -215,7 +215,7 @@ fn hover_simple(
215
215
} )
216
216
. flatten ( )
217
217
. unique_by ( |& ( def, _) | def)
218
- . filter_map ( |( def, node) | hover_for_definition ( sema, file_id, def, & node, config) )
218
+ . map ( |( def, node) | hover_for_definition ( sema, file_id, def, & node, config) )
219
219
. reduce ( |mut acc : HoverResult , HoverResult { markup, actions } | {
220
220
acc. actions . extend ( actions) ;
221
221
acc. markup = Markup :: from ( format ! ( "{}\n ---\n {markup}" , acc. markup) ) ;
@@ -373,9 +373,9 @@ pub(crate) fn hover_for_definition(
373
373
def : Definition ,
374
374
scope_node : & SyntaxNode ,
375
375
config : & HoverConfig ,
376
- ) -> Option < HoverResult > {
376
+ ) -> HoverResult {
377
377
let famous_defs = match & def {
378
- Definition :: BuiltinType ( _) => Some ( FamousDefs ( sema, sema . scope ( scope_node) ? . krate ( ) ) ) ,
378
+ Definition :: BuiltinType ( _) => sema. scope ( scope_node) . map ( |it| FamousDefs ( sema , it . krate ( ) ) ) ,
379
379
_ => None ,
380
380
} ;
381
381
@@ -396,20 +396,19 @@ pub(crate) fn hover_for_definition(
396
396
} ;
397
397
let notable_traits = def_ty. map ( |ty| notable_traits ( db, & ty) ) . unwrap_or_default ( ) ;
398
398
399
- render:: definition ( sema. db , def, famous_defs. as_ref ( ) , & notable_traits, config) . map ( |markup| {
400
- HoverResult {
401
- markup : render:: process_markup ( sema. db , def, & markup, config) ,
402
- actions : [
403
- show_implementations_action ( sema. db , def) ,
404
- show_fn_references_action ( sema. db , def) ,
405
- runnable_action ( sema, def, file_id) ,
406
- goto_type_action_for_def ( sema. db , def, & notable_traits) ,
407
- ]
408
- . into_iter ( )
409
- . flatten ( )
410
- . collect ( ) ,
411
- }
412
- } )
399
+ let markup = render:: definition ( sema. db , def, famous_defs. as_ref ( ) , & notable_traits, config) ;
400
+ HoverResult {
401
+ markup : render:: process_markup ( sema. db , def, & markup, config) ,
402
+ actions : [
403
+ show_implementations_action ( sema. db , def) ,
404
+ show_fn_references_action ( sema. db , def) ,
405
+ runnable_action ( sema, def, file_id) ,
406
+ goto_type_action_for_def ( sema. db , def, & notable_traits) ,
407
+ ]
408
+ . into_iter ( )
409
+ . flatten ( )
410
+ . collect ( ) ,
411
+ }
413
412
}
414
413
415
414
fn notable_traits (
0 commit comments