about summary refs log tree commit diff
path: root/compiler/rustc_lint
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2022-12-09 18:32:06 +0000
committerMaybe Waffle <waffle.lapkin@gmail.com>2022-12-09 18:32:06 +0000
commit84a46352ac541d93efaf142c163ebcf4c9a8b1fd (patch)
treeafb3055620987d010eb767fd64b1c6829f45cf82 /compiler/rustc_lint
parentc5351ad4dcd9f3d73241b2acbfc6b4631da845c5 (diff)
downloadrust-84a46352ac541d93efaf142c163ebcf4c9a8b1fd.tar.gz
rust-84a46352ac541d93efaf142c163ebcf4c9a8b1fd.zip
Don't warn about unused parens when they are used by yeet expr
Diffstat (limited to 'compiler/rustc_lint')
-rw-r--r--compiler/rustc_lint/src/unused.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs
index a7836ea8e7a..13b3ef43a59 100644
--- a/compiler/rustc_lint/src/unused.rs
+++ b/compiler/rustc_lint/src/unused.rs
@@ -617,7 +617,10 @@ trait UnusedDelimLint {
         lhs_needs_parens
             || (followed_by_block
                 && match &inner.kind {
-                    ExprKind::Ret(_) | ExprKind::Break(..) | ExprKind::Yield(..) => true,
+                    ExprKind::Ret(_)
+                    | ExprKind::Break(..)
+                    | ExprKind::Yield(..)
+                    | ExprKind::Yeet(..) => true,
                     ExprKind::Range(_lhs, Some(rhs), _limits) => {
                         matches!(rhs.kind, ExprKind::Block(..))
                     }