1
Fork 0

Rollup merge of #110545 - WaffleLapkin:generic_arg_as_x, r=cjgillot

Add `GenericArgKind::as_{type,const,region}`

This allows to make code nicer in some cases
This commit is contained in:
Matthias Krüger 2023-04-20 14:36:54 +02:00 committed by GitHub
commit 17f6763a14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 84 additions and 110 deletions

View file

@ -166,10 +166,8 @@ declare_lint_pass!(BoxPointers => [BOX_POINTERS]);
impl BoxPointers {
fn check_heap_type(&self, cx: &LateContext<'_>, span: Span, ty: Ty<'_>) {
for leaf in ty.walk() {
if let GenericArgKind::Type(leaf_ty) = leaf.unpack() {
if leaf_ty.is_box() {
cx.emit_spanned_lint(BOX_POINTERS, span, BuiltinBoxPointers { ty });
}
if let GenericArgKind::Type(leaf_ty) = leaf.unpack() && leaf_ty.is_box() {
cx.emit_spanned_lint(BOX_POINTERS, span, BuiltinBoxPointers { ty });
}
}
}