about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-03-16 22:00:08 +0000
committerMichael Goulet <michael@errs.io>2023-03-28 01:14:28 +0000
commitfc6262fa0c0cd9bd3e32b3db4f3df5c268acf291 (patch)
tree607e606d7c98a88e12f32ce6c3a4c39632fed90a
parent538e8bdcc8d4402c0c4bb95eb47162ca4e11f74d (diff)
downloadrust-fc6262fa0c0cd9bd3e32b3db4f3df5c268acf291.tar.gz
rust-fc6262fa0c0cd9bd3e32b3db4f3df5c268acf291.zip
Add `(..)` syntax for RTN
-rw-r--r--clippy_lints/src/ref_option_ref.rs4
-rw-r--r--clippy_lints/src/types/borrowed_box.rs2
-rw-r--r--clippy_lints/src/types/utils.rs4
-rw-r--r--clippy_lints/src/use_self.rs5
-rw-r--r--clippy_utils/src/hir_utils.rs7
5 files changed, 9 insertions, 13 deletions
diff --git a/clippy_lints/src/ref_option_ref.rs b/clippy_lints/src/ref_option_ref.rs
index 448a32b77c0..c984a8286eb 100644
--- a/clippy_lints/src/ref_option_ref.rs
+++ b/clippy_lints/src/ref_option_ref.rs
@@ -3,7 +3,7 @@ use clippy_utils::last_path_segment;
 use clippy_utils::source::snippet;
 use if_chain::if_chain;
 use rustc_errors::Applicability;
-use rustc_hir::{GenericArg, Mutability, Ty, TyKind};
+use rustc_hir::{GenericArg, GenericArgsParentheses, Mutability, Ty, TyKind};
 use rustc_lint::{LateContext, LateLintPass};
 use rustc_session::{declare_lint_pass, declare_tool_lint};
 use rustc_span::symbol::sym;
@@ -47,7 +47,7 @@ impl<'tcx> LateLintPass<'tcx> for RefOptionRef {
 
             if cx.tcx.is_diagnostic_item(sym::Option, def_id);
             if let Some(params) = last_path_segment(qpath).args ;
-            if !params.parenthesized;
+            if params.parenthesized == GenericArgsParentheses::No;
             if let Some(inner_ty) = params.args.iter().find_map(|arg| match arg {
                 GenericArg::Type(inner_ty) => Some(inner_ty),
                 _ => None,
diff --git a/clippy_lints/src/types/borrowed_box.rs b/clippy_lints/src/types/borrowed_box.rs
index 65dfe7637ea..acdf5471069 100644
--- a/clippy_lints/src/types/borrowed_box.rs
+++ b/clippy_lints/src/types/borrowed_box.rs
@@ -20,7 +20,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, lt: &Lifetime, m
                 if let QPath::Resolved(None, path) = *qpath;
                 if let [ref bx] = *path.segments;
                 if let Some(params) = bx.args;
-                if !params.parenthesized;
+                if params.parenthesized == hir::GenericArgsParentheses::No;
                 if let Some(inner) = params.args.iter().find_map(|arg| match arg {
                     GenericArg::Type(ty) => Some(ty),
                     _ => None,
diff --git a/clippy_lints/src/types/utils.rs b/clippy_lints/src/types/utils.rs
index 7f43b7841ff..a30748db88f 100644
--- a/clippy_lints/src/types/utils.rs
+++ b/clippy_lints/src/types/utils.rs
@@ -1,6 +1,6 @@
 use clippy_utils::last_path_segment;
 use if_chain::if_chain;
-use rustc_hir::{GenericArg, QPath, TyKind};
+use rustc_hir::{GenericArg, GenericArgsParentheses, QPath, TyKind};
 use rustc_lint::LateContext;
 use rustc_span::source_map::Span;
 
@@ -8,7 +8,7 @@ pub(super) fn match_borrows_parameter(_cx: &LateContext<'_>, qpath: &QPath<'_>)
     let last = last_path_segment(qpath);
     if_chain! {
         if let Some(params) = last.args;
-        if !params.parenthesized;
+        if params.parenthesized == GenericArgsParentheses::No;
         if let Some(ty) = params.args.iter().find_map(|arg| match arg {
             GenericArg::Type(ty) => Some(ty),
             _ => None,
diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs
index 8ea5475fb25..7dfb0956077 100644
--- a/clippy_lints/src/use_self.rs
+++ b/clippy_lints/src/use_self.rs
@@ -10,7 +10,7 @@ use rustc_hir::{
     def::{CtorOf, DefKind, Res},
     def_id::LocalDefId,
     intravisit::{walk_inf, walk_ty, Visitor},
-    Expr, ExprKind, FnRetTy, FnSig, GenericArg, GenericParam, GenericParamKind, HirId, Impl, ImplItemKind, Item,
+    Expr, ExprKind, FnRetTy, FnSig, GenericArg, GenericArgsParentheses, GenericParam, GenericParamKind, HirId, Impl, ImplItemKind, Item,
     ItemKind, Pat, PatKind, Path, QPath, Ty, TyKind,
 };
 use rustc_hir_analysis::hir_ty_to_ty;
@@ -100,7 +100,8 @@ impl<'tcx> LateLintPass<'tcx> for UseSelf {
             if let TyKind::Path(QPath::Resolved(_, item_path)) = self_ty.kind;
             let parameters = &item_path.segments.last().expect(SEGMENTS_MSG).args;
             if parameters.as_ref().map_or(true, |params| {
-                !params.parenthesized && !params.args.iter().any(|arg| matches!(arg, GenericArg::Lifetime(_)))
+                params.parenthesized  == GenericArgsParentheses::No
+                    && !params.args.iter().any(|arg| matches!(arg, GenericArg::Lifetime(_)))
             });
             if !item.span.from_expansion();
             if !is_from_proc_macro(cx, item); // expensive, should be last check
diff --git a/clippy_utils/src/hir_utils.rs b/clippy_utils/src/hir_utils.rs
index 3a6d23ca5c1..3ee7147828b 100644
--- a/clippy_utils/src/hir_utils.rs
+++ b/clippy_utils/src/hir_utils.rs
@@ -401,14 +401,9 @@ impl HirEqInterExpr<'_, '_, '_> {
     }
 
     fn eq_path_parameters(&mut self, left: &GenericArgs<'_>, right: &GenericArgs<'_>) -> bool {
-        if !(left.parenthesized || right.parenthesized) {
+        if left.parenthesized == right.parenthesized {
             over(left.args, right.args, |l, r| self.eq_generic_arg(l, r)) // FIXME(flip1995): may not work
                 && over(left.bindings, right.bindings, |l, r| self.eq_type_binding(l, r))
-        } else if left.parenthesized && right.parenthesized {
-            over(left.inputs(), right.inputs(), |l, r| self.eq_ty(l, r))
-                && both(&Some(&left.bindings[0].ty()), &Some(&right.bindings[0].ty()), |l, r| {
-                    self.eq_ty(l, r)
-                })
         } else {
             false
         }