about summary refs log tree commit diff
path: root/tests/ui/unnested_or_patterns.fixed
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-23 05:05:23 +0000
committerbors <bors@rust-lang.org>2022-10-23 05:05:23 +0000
commit28cd1ec9b7dc0eef2ecf9f3ee95fd2179802b712 (patch)
treeccafaa0ca9e6944c71b03ea9e39ac724f5b86ac6 /tests/ui/unnested_or_patterns.fixed
parentb62ef608d751925398ef33d1946acde2eab90d49 (diff)
parent815876d93f75c4d20c52cdd32f1a521ce306be63 (diff)
downloadrust-28cd1ec9b7dc0eef2ecf9f3ee95fd2179802b712.tar.gz
rust-28cd1ec9b7dc0eef2ecf9f3ee95fd2179802b712.zip
Auto merge of #9688 - Alexendoo:msrv-tests, r=Manishearth
Move MSRV tests into the lint specific test files

There are currently two ways MSRV tests are done in the ui test suite, adding a case to the `#![clippy::msrv = "1.0"]` `tests/ui/min_rust_version_attr.rs` or adding the two `msrv_1_xx` functions to the test file of the lint in question

This updates the clippy book to suggest the `msrv_1_xx` style, and replaces the tests in `tests/ui/min_rust_version_attr.rs` with ones of that style

Almost the entire diff is just moving stuff around as a result, I made sure to check the line numbers the lints are emitted at correspond with the right `msrv` case, so feel free to only skim that part

changelog: none
Diffstat (limited to 'tests/ui/unnested_or_patterns.fixed')
-rw-r--r--tests/ui/unnested_or_patterns.fixed16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/ui/unnested_or_patterns.fixed b/tests/ui/unnested_or_patterns.fixed
index c223b5bc711..9786c7b1212 100644
--- a/tests/ui/unnested_or_patterns.fixed
+++ b/tests/ui/unnested_or_patterns.fixed
@@ -1,9 +1,9 @@
 // run-rustfix
 
-#![feature(box_patterns)]
+#![feature(box_patterns, custom_inner_attributes)]
 #![warn(clippy::unnested_or_patterns)]
 #![allow(clippy::cognitive_complexity, clippy::match_ref_pats, clippy::upper_case_acronyms)]
-#![allow(unreachable_patterns, irrefutable_let_patterns, unused_variables)]
+#![allow(unreachable_patterns, irrefutable_let_patterns, unused)]
 
 fn main() {
     // Should be ignored by this lint, as nesting requires more characters.
@@ -33,3 +33,15 @@ fn main() {
     if let S { x: 0 | 1, y } = (S { x: 0, y: 1 }) {}
     if let S { x: 0, y, .. } | S { y, x: 1 } = (S { x: 0, y: 1 }) {}
 }
+
+fn msrv_1_52() {
+    #![clippy::msrv = "1.52"]
+
+    if let [1] | [52] = [0] {}
+}
+
+fn msrv_1_53() {
+    #![clippy::msrv = "1.53"]
+
+    if let [1 | 53] = [0] {}
+}