Rollup merge of #104796 - notriddle:notriddle/unused-issue-104397, r=oli-obk

lint: do not warn unused parens around higher-ranked function pointers

Fixes #104397
This commit is contained in:
Matthias Krüger 2022-11-24 21:34:56 +01:00 committed by GitHub
commit 83d1aab9ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -1015,6 +1015,7 @@ fn check_ty(&mut self, cx: &EarlyContext<'_>, ty: &ast::Ty) {
if let ast::TyKind::Paren(r) = &ty.kind {
match &r.kind {
ast::TyKind::TraitObject(..) => {}
ast::TyKind::BareFn(b) if b.generic_params.len() > 0 => {}
ast::TyKind::ImplTrait(_, bounds) if bounds.len() > 1 => {}
ast::TyKind::Array(_, len) => {
self.check_unused_delims_expr(

View File

@ -0,0 +1,18 @@
// check-pass
#![warn(unused)]
#![deny(warnings)]
struct Inv<'a>(&'a mut &'a ());
trait Trait {}
impl Trait for for<'a> fn(Inv<'a>) {}
fn with_bound()
where
(for<'a> fn(Inv<'a>)): Trait,
{}
fn main() {
with_bound();
}