about summary refs log tree commit diff
path: root/tests/ui/mem_replace.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/mem_replace.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/mem_replace.fixed')
-rw-r--r--tests/ui/mem_replace.fixed18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/ui/mem_replace.fixed b/tests/ui/mem_replace.fixed
index b609ba65946..ae237395b95 100644
--- a/tests/ui/mem_replace.fixed
+++ b/tests/ui/mem_replace.fixed
@@ -1,5 +1,7 @@
 // run-rustfix
-#![allow(unused_imports)]
+
+#![feature(custom_inner_attributes)]
+#![allow(unused)]
 #![warn(
     clippy::all,
     clippy::style,
@@ -77,3 +79,17 @@ fn main() {
     replace_with_default();
     dont_lint_primitive();
 }
+
+fn msrv_1_39() {
+    #![clippy::msrv = "1.39"]
+
+    let mut s = String::from("foo");
+    let _ = std::mem::replace(&mut s, String::default());
+}
+
+fn msrv_1_40() {
+    #![clippy::msrv = "1.40"]
+
+    let mut s = String::from("foo");
+    let _ = std::mem::take(&mut s);
+}