@@ -93,7 +93,15 @@ pub(crate) fn hover(
9393 }
9494 }
9595 } ) ?;
96- return hover_type_info ( & sema, config, expr) . map ( |it| RangeInfo :: new ( range, it) ) ;
96+ return hover_type_info ( & sema, config, & expr) . map ( |it| {
97+ RangeInfo :: new (
98+ match expr {
99+ Either :: Left ( it) => it. syntax ( ) . text_range ( ) ,
100+ Either :: Right ( it) => it. syntax ( ) . text_range ( ) ,
101+ } ,
102+ it,
103+ )
104+ } ) ;
97105 } ;
98106
99107 let token = pick_best_token ( file. token_at_offset ( offset) , |kind| match kind {
@@ -207,24 +215,24 @@ pub(crate) fn hover(
207215 }
208216 } ;
209217
210- let res = hover_type_info ( & sema, config, expr_or_pat) ?;
218+ let res = hover_type_info ( & sema, config, & expr_or_pat) ?;
211219 let range = sema. original_range ( & node) . range ;
212220 Some ( RangeInfo :: new ( range, res) )
213221}
214222
215223fn hover_type_info (
216224 sema : & Semantics < RootDatabase > ,
217225 config : & HoverConfig ,
218- expr_or_pat : Either < ast:: Expr , ast:: Pat > ,
226+ expr_or_pat : & Either < ast:: Expr , ast:: Pat > ,
219227) -> Option < HoverResult > {
220- let ( ty, coerced) = match & expr_or_pat {
228+ let ( ty, coerced) = match expr_or_pat {
221229 Either :: Left ( expr) => sema. type_of_expr_with_coercion ( expr) ?,
222230 Either :: Right ( pat) => sema. type_of_pat_with_coercion ( pat) ?,
223231 } ;
224232
225233 let mut res = HoverResult :: default ( ) ;
226234 res. markup = if coerced {
227- let uncoerced_ty = match & expr_or_pat {
235+ let uncoerced_ty = match expr_or_pat {
228236 Either :: Left ( expr) => sema. type_of_expr ( expr) ?,
229237 Either :: Right ( pat) => sema. type_of_pat ( pat) ?,
230238 } ;
0 commit comments