about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-03-09 09:05:20 +0000
committerGitHub <noreply@github.com>2021-03-09 09:05:20 +0000
commit824662d78a03b7ef12862eb6b12d8ccda4dfe7a4 (patch)
tree610f7b1c7b44fd85fa496ef3428314e6a8b04ec1
parentf3b68d307aa869bfd6203685e726a2e91c92ff21 (diff)
parent7e4f5ca38ee1ec1c7847b1f8a8eb9e116ddd25ad (diff)
downloadrust-824662d78a03b7ef12862eb6b12d8ccda4dfe7a4.tar.gz
rust-824662d78a03b7ef12862eb6b12d8ccda4dfe7a4.zip
Rollup merge of #82048 - mark-i-m:or-pat-type-ascription, r=petrochenkov
or-patterns: disallow in `let` bindings

~~Blocked on https://github.com/rust-lang/rust/pull/81869~~

Disallows top-level or-patterns before type ascription. We want to reserve this syntactic space for possible future generalized type ascription.

r? ``@petrochenkov``
-rw-r--r--clippy_lints/src/loops.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs
index 63d9b7f8645..c89a0876575 100644
--- a/clippy_lints/src/loops.rs
+++ b/clippy_lints/src/loops.rs
@@ -885,7 +885,9 @@ struct MinifyingSugg<'a>(Sugg<'a>);
 
 impl<'a> MinifyingSugg<'a> {
     fn as_str(&self) -> &str {
-        let Sugg::NonParen(s) | Sugg::MaybeParen(s) | Sugg::BinOp(_, s) = &self.0;
+        let s = match &self.0 {
+            Sugg::NonParen(s) | Sugg::MaybeParen(s) | Sugg::BinOp(_, s) => s,
+        };
         s.as_ref()
     }