lint: do not warn unused parens around higher-ranked function pointers
Fixes #104397
This commit is contained in:
parent
80b3c6dbde
commit
97d95d48e2
@ -1002,6 +1002,7 @@ impl EarlyLintPass for UnusedParens {
|
|||||||
if let ast::TyKind::Paren(r) = &ty.kind {
|
if let ast::TyKind::Paren(r) = &ty.kind {
|
||||||
match &r.kind {
|
match &r.kind {
|
||||||
ast::TyKind::TraitObject(..) => {}
|
ast::TyKind::TraitObject(..) => {}
|
||||||
|
ast::TyKind::BareFn(b) if b.generic_params.len() > 0 => {}
|
||||||
ast::TyKind::ImplTrait(_, bounds) if bounds.len() > 1 => {}
|
ast::TyKind::ImplTrait(_, bounds) if bounds.len() > 1 => {}
|
||||||
ast::TyKind::Array(_, len) => {
|
ast::TyKind::Array(_, len) => {
|
||||||
self.check_unused_delims_expr(
|
self.check_unused_delims_expr(
|
||||||
|
18
src/test/ui/lint/unused/issue-104397.rs
Normal file
18
src/test/ui/lint/unused/issue-104397.rs
Normal 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();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user