@@ -187,13 +187,12 @@ fn make_mirror_unadjusted<'a, 'tcx>(
187
187
if let Some ( ( adt_def, index) ) = adt_data {
188
188
let substs = cx. tables ( ) . node_substs ( fun. hir_id ) ;
189
189
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
+ } ) ;
197
196
debug ! ( "make_mirror_unadjusted: (call) user_ty={:?}" , user_ty) ;
198
197
199
198
let field_refs = args
@@ -329,7 +328,7 @@ fn make_mirror_unadjusted<'a, 'tcx>(
329
328
ty:: Adt ( adt, substs) => match adt. adt_kind ( ) {
330
329
AdtKind :: Struct | AdtKind :: Union => {
331
330
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 ( ) ;
333
332
debug ! ( "make_mirror_unadjusted: (struct/union) user_ty={:?}" , user_ty) ;
334
333
ExprKind :: Adt {
335
334
adt_def : adt,
@@ -351,7 +350,7 @@ fn make_mirror_unadjusted<'a, 'tcx>(
351
350
352
351
let index = adt. variant_index_with_id ( variant_id) ;
353
352
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 ( ) ;
355
354
debug ! ( "make_mirror_unadjusted: (variant) user_ty={:?}" , user_ty) ;
356
355
ExprKind :: Adt {
357
356
adt_def : adt,
@@ -570,7 +569,7 @@ fn make_mirror_unadjusted<'a, 'tcx>(
570
569
}
571
570
hir:: ExprKind :: Type ( ref source, ref ty) => {
572
571
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 ( ) ;
574
573
debug ! ( "make_mirror_unadjusted: (type) user_ty={:?}" , user_ty) ;
575
574
if source. is_syntactic_place_expr ( ) {
576
575
ExprKind :: PlaceTypeAscription { source : source. to_ref ( ) , user_ty }
@@ -605,7 +604,7 @@ fn user_substs_applied_to_res<'tcx>(
605
604
| Res :: Def ( DefKind :: Ctor ( _, CtorKind :: Fn ) , _)
606
605
| Res :: Def ( DefKind :: Const , _)
607
606
| 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 ( )
609
608
}
610
609
611
610
// A unit struct/variant which is used as a value (e.g.,
@@ -744,7 +743,7 @@ fn convert_path_expr<'a, 'tcx>(
744
743
745
744
Res :: Def ( DefKind :: Ctor ( _, CtorKind :: Const ) , def_id) => {
746
745
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 ( ) ;
748
747
debug ! ( "convert_path_expr: user_provided_type={:?}" , user_provided_type) ;
749
748
let ty = cx. tables ( ) . node_type ( expr. hir_id ) ;
750
749
match ty. kind {
0 commit comments