@@ -147,7 +147,7 @@ fn hover_simple(
147147 if let Some ( doc_comment) = token_as_doc_comment ( & original_token) {
148148 cov_mark:: hit!( no_highlight_on_comment_hover) ;
149149 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) ;
151151 Some ( RangeInfo :: new ( range, res) )
152152 } ) ;
153153 }
@@ -161,7 +161,7 @@ fn hover_simple(
161161 Definition :: from ( resolution?) ,
162162 & original_token. parent ( ) ?,
163163 config,
164- ) ? ;
164+ ) ;
165165 return Some ( RangeInfo :: new ( range, res) ) ;
166166 }
167167
@@ -215,7 +215,7 @@ fn hover_simple(
215215 } )
216216 . flatten ( )
217217 . 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) )
219219 . reduce ( |mut acc : HoverResult , HoverResult { markup, actions } | {
220220 acc. actions . extend ( actions) ;
221221 acc. markup = Markup :: from ( format ! ( "{}\n ---\n {markup}" , acc. markup) ) ;
@@ -373,9 +373,9 @@ pub(crate) fn hover_for_definition(
373373 def : Definition ,
374374 scope_node : & SyntaxNode ,
375375 config : & HoverConfig ,
376- ) -> Option < HoverResult > {
376+ ) -> HoverResult {
377377 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 ( ) ) ) ,
379379 _ => None ,
380380 } ;
381381
@@ -396,20 +396,19 @@ pub(crate) fn hover_for_definition(
396396 } ;
397397 let notable_traits = def_ty. map ( |ty| notable_traits ( db, & ty) ) . unwrap_or_default ( ) ;
398398
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+ }
413412}
414413
415414fn notable_traits (
0 commit comments