summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/infallible_destructuring_match.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/infallible_destructuring_match.rs')
-rw-r--r--src/tools/clippy/tests/ui/infallible_destructuring_match.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/infallible_destructuring_match.rs b/src/tools/clippy/tests/ui/infallible_destructuring_match.rs
index 106cd438b..f2768245b 100644
--- a/src/tools/clippy/tests/ui/infallible_destructuring_match.rs
+++ b/src/tools/clippy/tests/ui/infallible_destructuring_match.rs
@@ -9,6 +9,9 @@ enum SingleVariantEnum {
struct TupleStruct(i32);
+struct NonCopy;
+struct TupleStructWithNonCopy(NonCopy);
+
enum EmptyEnum {}
macro_rules! match_enum {
@@ -75,6 +78,17 @@ fn infallible_destructuring_match_struct() {
let TupleStruct(data) = wrapper;
}
+fn infallible_destructuring_match_struct_with_noncopy() {
+ let wrapper = TupleStructWithNonCopy(NonCopy);
+
+ // This should lint! (keeping `ref` in the suggestion)
+ let data = match wrapper {
+ TupleStructWithNonCopy(ref n) => n,
+ };
+
+ let TupleStructWithNonCopy(ref data) = wrapper;
+}
+
macro_rules! match_never_enum {
($param:expr) => {
let data = match $param {