Auto merge of #13115 - tesuji:rm-dup-peels, r=dswij
Remove duplicated `peel_middle_ty_refs` TODO: Should we move `ty::peel_mid_ty_refs_is_mutable` to super module too? changelog: none
This commit is contained in:
commit
1ea827fa03
7 changed files with 22 additions and 35 deletions
|
|
@ -525,19 +525,6 @@ pub fn needs_ordered_drop<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
|
|||
needs_ordered_drop_inner(cx, ty, &mut FxHashSet::default())
|
||||
}
|
||||
|
||||
/// Peels off all references on the type. Returns the underlying type and the number of references
|
||||
/// removed.
|
||||
pub fn peel_mid_ty_refs(ty: Ty<'_>) -> (Ty<'_>, usize) {
|
||||
fn peel(ty: Ty<'_>, count: usize) -> (Ty<'_>, usize) {
|
||||
if let ty::Ref(_, ty, _) = ty.kind() {
|
||||
peel(*ty, count + 1)
|
||||
} else {
|
||||
(ty, count)
|
||||
}
|
||||
}
|
||||
peel(ty, 0)
|
||||
}
|
||||
|
||||
/// Peels off all references on the type. Returns the underlying type, the number of references
|
||||
/// removed, and whether the pointer is ultimately mutable or not.
|
||||
pub fn peel_mid_ty_refs_is_mutable(ty: Ty<'_>) -> (Ty<'_>, usize, Mutability) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue