Skip to content

Commit 0e440e1

Browse files
committed
fix tests
1 parent ca5b59a commit 0e440e1

File tree

1 file changed

+1
-43
lines changed

1 file changed

+1
-43
lines changed

clippy_utils/src/ty.rs

+1-43
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ pub fn ty_sig<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<ExprFnSig<'t
719719
let output = bounds
720720
.projection_bounds()
721721
.find(|p| lang_items.fn_once_output().is_some_and(|id| id == p.item_def_id()))
722-
.map(|p| p.map_bound(|p| p.term.as_type().unwrap()));
722+
.map(|p| p.map_bound(|p| p.term.expect_type()));
723723
Some(ExprFnSig::Trait(bound.map_bound(|b| b.args.type_at(0)), output, None))
724724
},
725725
_ => None,
@@ -1236,48 +1236,6 @@ impl<'tcx> InteriorMut<'tcx> {
12361236
}
12371237
}
12381238

1239-
/// Check if given type has inner mutability such as [`std::cell::Cell`] or [`std::cell::RefCell`]
1240-
/// etc.
1241-
pub fn is_interior_mut_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
1242-
match *ty.kind() {
1243-
ty::Ref(_, inner_ty, mutbl) => mutbl == Mutability::Mut || is_interior_mut_ty(cx, inner_ty),
1244-
ty::Slice(inner_ty) => is_interior_mut_ty(cx, inner_ty),
1245-
ty::Array(inner_ty, size) => {
1246-
size.try_eval_target_usize(cx.tcx, cx.param_env) != Some(0) && is_interior_mut_ty(cx, inner_ty)
1247-
},
1248-
ty::Tuple(fields) => fields.iter().any(|ty| is_interior_mut_ty(cx, ty)),
1249-
ty::Adt(def, args) => {
1250-
// Special case for collections in `std` who's impl of `Hash` or `Ord` delegates to
1251-
// that of their type parameters. Note: we don't include `HashSet` and `HashMap`
1252-
// because they have no impl for `Hash` or `Ord`.
1253-
let def_id = def.did();
1254-
let is_std_collection = [
1255-
sym::Option,
1256-
sym::Result,
1257-
sym::LinkedList,
1258-
sym::Vec,
1259-
sym::VecDeque,
1260-
sym::BTreeMap,
1261-
sym::BTreeSet,
1262-
sym::Rc,
1263-
sym::Arc,
1264-
]
1265-
.iter()
1266-
.any(|diag_item| cx.tcx.is_diagnostic_item(*diag_item, def_id));
1267-
let is_box = Some(def_id) == cx.tcx.lang_items().owned_box();
1268-
if is_std_collection || is_box {
1269-
// The type is mutable if any of its type parameters are
1270-
args.types().any(|ty| is_interior_mut_ty(cx, ty))
1271-
} else {
1272-
!ty.has_escaping_bound_vars()
1273-
&& cx.tcx.layout_of(cx.param_env.and(ty)).is_ok()
1274-
&& !ty.is_freeze(cx.tcx, cx.param_env)
1275-
}
1276-
},
1277-
_ => false,
1278-
}
1279-
}
1280-
12811239
pub fn make_normalized_projection_with_regions<'tcx>(
12821240
tcx: TyCtxt<'tcx>,
12831241
param_env: ParamEnv<'tcx>,

0 commit comments

Comments
 (0)