if let Some((adt_def, index)) = adt_data {
let substs = cx.tables().node_substs(fun.hir_id);
let user_provided_types = cx.tables().user_provided_types();
- let user_ty =
- user_provided_types.get(fun.hir_id).map(|u_ty| *u_ty).map(|mut u_ty| {
- if let UserType::TypeOf(ref mut did, _) = &mut u_ty.value {
- *did = adt_def.did;
- }
- u_ty
- });
+ let user_ty = user_provided_types.get(fun.hir_id).copied().map(|mut u_ty| {
+ if let UserType::TypeOf(ref mut did, _) = &mut u_ty.value {
+ *did = adt_def.did;
+ }
+ u_ty
+ });
debug!("make_mirror_unadjusted: (call) user_ty={:?}", user_ty);
let field_refs = args
ty::Adt(adt, substs) => match adt.adt_kind() {
AdtKind::Struct | AdtKind::Union => {
let user_provided_types = cx.tables().user_provided_types();
- let user_ty = user_provided_types.get(expr.hir_id).map(|u_ty| *u_ty);
+ let user_ty = user_provided_types.get(expr.hir_id).copied();
debug!("make_mirror_unadjusted: (struct/union) user_ty={:?}", user_ty);
ExprKind::Adt {
adt_def: adt,
let index = adt.variant_index_with_id(variant_id);
let user_provided_types = cx.tables().user_provided_types();
- let user_ty = user_provided_types.get(expr.hir_id).map(|u_ty| *u_ty);
+ let user_ty = user_provided_types.get(expr.hir_id).copied();
debug!("make_mirror_unadjusted: (variant) user_ty={:?}", user_ty);
ExprKind::Adt {
adt_def: adt,
}
hir::ExprKind::Type(ref source, ref ty) => {
let user_provided_types = cx.tables.user_provided_types();
- let user_ty = user_provided_types.get(ty.hir_id).map(|u_ty| *u_ty);
+ let user_ty = user_provided_types.get(ty.hir_id).copied();
debug!("make_mirror_unadjusted: (type) user_ty={:?}", user_ty);
if source.is_syntactic_place_expr() {
ExprKind::PlaceTypeAscription { source: source.to_ref(), user_ty }
| Res::Def(DefKind::Ctor(_, CtorKind::Fn), _)
| Res::Def(DefKind::Const, _)
| Res::Def(DefKind::AssocConst, _) => {
- cx.tables().user_provided_types().get(hir_id).map(|u_ty| *u_ty)
+ cx.tables().user_provided_types().get(hir_id).copied()
}
// A unit struct/variant which is used as a value (e.g.,
Res::Def(DefKind::Ctor(_, CtorKind::Const), def_id) => {
let user_provided_types = cx.tables.user_provided_types();
- let user_provided_type = user_provided_types.get(expr.hir_id).map(|u_ty| *u_ty);
+ let user_provided_type = user_provided_types.get(expr.hir_id).copied();
debug!("convert_path_expr: user_provided_type={:?}", user_provided_type);
let ty = cx.tables().node_type(expr.hir_id);
match ty.kind {