@@ -187,13 +187,12 @@ fn make_mirror_unadjusted<'a, 'tcx>(
187187 if let Some ( ( adt_def, index) ) = adt_data {
188188 let substs = cx. tables ( ) . node_substs ( fun. hir_id ) ;
189189 let user_provided_types = cx. tables ( ) . user_provided_types ( ) ;
190- let user_ty =
191- user_provided_types. get ( fun. hir_id ) . map ( |u_ty| * u_ty) . map ( |mut u_ty| {
192- if let UserType :: TypeOf ( ref mut did, _) = & mut u_ty. value {
193- * did = adt_def. did ;
194- }
195- u_ty
196- } ) ;
190+ let user_ty = user_provided_types. get ( fun. hir_id ) . copied ( ) . map ( |mut u_ty| {
191+ if let UserType :: TypeOf ( ref mut did, _) = & mut u_ty. value {
192+ * did = adt_def. did ;
193+ }
194+ u_ty
195+ } ) ;
197196 debug ! ( "make_mirror_unadjusted: (call) user_ty={:?}" , user_ty) ;
198197
199198 let field_refs = args
@@ -329,7 +328,7 @@ fn make_mirror_unadjusted<'a, 'tcx>(
329328 ty:: Adt ( adt, substs) => match adt. adt_kind ( ) {
330329 AdtKind :: Struct | AdtKind :: Union => {
331330 let user_provided_types = cx. tables ( ) . user_provided_types ( ) ;
332- let user_ty = user_provided_types. get ( expr. hir_id ) . map ( |u_ty| * u_ty ) ;
331+ let user_ty = user_provided_types. get ( expr. hir_id ) . copied ( ) ;
333332 debug ! ( "make_mirror_unadjusted: (struct/union) user_ty={:?}" , user_ty) ;
334333 ExprKind :: Adt {
335334 adt_def : adt,
@@ -351,7 +350,7 @@ fn make_mirror_unadjusted<'a, 'tcx>(
351350
352351 let index = adt. variant_index_with_id ( variant_id) ;
353352 let user_provided_types = cx. tables ( ) . user_provided_types ( ) ;
354- let user_ty = user_provided_types. get ( expr. hir_id ) . map ( |u_ty| * u_ty ) ;
353+ let user_ty = user_provided_types. get ( expr. hir_id ) . copied ( ) ;
355354 debug ! ( "make_mirror_unadjusted: (variant) user_ty={:?}" , user_ty) ;
356355 ExprKind :: Adt {
357356 adt_def : adt,
@@ -570,7 +569,7 @@ fn make_mirror_unadjusted<'a, 'tcx>(
570569 }
571570 hir:: ExprKind :: Type ( ref source, ref ty) => {
572571 let user_provided_types = cx. tables . user_provided_types ( ) ;
573- let user_ty = user_provided_types. get ( ty. hir_id ) . map ( |u_ty| * u_ty ) ;
572+ let user_ty = user_provided_types. get ( ty. hir_id ) . copied ( ) ;
574573 debug ! ( "make_mirror_unadjusted: (type) user_ty={:?}" , user_ty) ;
575574 if source. is_syntactic_place_expr ( ) {
576575 ExprKind :: PlaceTypeAscription { source : source. to_ref ( ) , user_ty }
@@ -605,7 +604,7 @@ fn user_substs_applied_to_res<'tcx>(
605604 | Res :: Def ( DefKind :: Ctor ( _, CtorKind :: Fn ) , _)
606605 | Res :: Def ( DefKind :: Const , _)
607606 | Res :: Def ( DefKind :: AssocConst , _) => {
608- cx. tables ( ) . user_provided_types ( ) . get ( hir_id) . map ( |u_ty| * u_ty )
607+ cx. tables ( ) . user_provided_types ( ) . get ( hir_id) . copied ( )
609608 }
610609
611610 // A unit struct/variant which is used as a value (e.g.,
@@ -744,7 +743,7 @@ fn convert_path_expr<'a, 'tcx>(
744743
745744 Res :: Def ( DefKind :: Ctor ( _, CtorKind :: Const ) , def_id) => {
746745 let user_provided_types = cx. tables . user_provided_types ( ) ;
747- let user_provided_type = user_provided_types. get ( expr. hir_id ) . map ( |u_ty| * u_ty ) ;
746+ let user_provided_type = user_provided_types. get ( expr. hir_id ) . copied ( ) ;
748747 debug ! ( "convert_path_expr: user_provided_type={:?}" , user_provided_type) ;
749748 let ty = cx. tables ( ) . node_type ( expr. hir_id ) ;
750749 match ty. kind {
0 commit comments