about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.default.stderr11
-rw-r--r--tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.enabled.stderr23
-rw-r--r--tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.rs31
-rw-r--r--tests/ui-toml/check_incompatible_msrv_in_tests/default/clippy.toml1
-rw-r--r--tests/ui-toml/check_incompatible_msrv_in_tests/enabled/clippy.toml1
-rw-r--r--tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr3
6 files changed, 70 insertions, 0 deletions
diff --git a/tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.default.stderr b/tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.default.stderr
new file mode 100644
index 00000000000..2a6170b0bcd
--- /dev/null
+++ b/tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.default.stderr
@@ -0,0 +1,11 @@
+error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.4.0`
+  --> tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.rs:14:5
+   |
+LL |     sleep(Duration::new(1, 0))
+   |     ^^^^^
+   |
+   = note: `-D clippy::incompatible-msrv` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.enabled.stderr b/tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.enabled.stderr
new file mode 100644
index 00000000000..8a85d38fba3
--- /dev/null
+++ b/tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.enabled.stderr
@@ -0,0 +1,23 @@
+error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.4.0`
+  --> tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.rs:14:5
+   |
+LL |     sleep(Duration::new(1, 0))
+   |     ^^^^^
+   |
+   = note: `-D clippy::incompatible-msrv` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
+
+error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.4.0`
+  --> tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.rs:20:5
+   |
+LL |     sleep(Duration::new(1, 0));
+   |     ^^^^^
+
+error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.4.0`
+  --> tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.rs:28:9
+   |
+LL |         sleep(Duration::new(1, 0));
+   |         ^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.rs b/tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.rs
new file mode 100644
index 00000000000..fed5f350b72
--- /dev/null
+++ b/tests/ui-toml/check_incompatible_msrv_in_tests/check_incompatible_msrv_in_tests.rs
@@ -0,0 +1,31 @@
+//@compile-flags: --test
+//@revisions: default enabled
+//@[enabled] rustc-env:CLIPPY_CONF_DIR=tests/ui-toml/check_incompatible_msrv_in_tests/enabled
+//@[default] rustc-env:CLIPPY_CONF_DIR=tests/ui-toml/check_incompatible_msrv_in_tests/default
+
+#![warn(clippy::incompatible_msrv)]
+#![feature(custom_inner_attributes)]
+#![clippy::msrv = "1.3.0"]
+
+use std::thread::sleep;
+use std::time::Duration;
+
+fn main() {
+    sleep(Duration::new(1, 0))
+    //~^ incompatible_msrv
+}
+
+#[test]
+fn test() {
+    sleep(Duration::new(1, 0));
+    //~[enabled]^ incompatible_msrv
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    fn helper() {
+        sleep(Duration::new(1, 0));
+        //~[enabled]^ incompatible_msrv
+    }
+}
diff --git a/tests/ui-toml/check_incompatible_msrv_in_tests/default/clippy.toml b/tests/ui-toml/check_incompatible_msrv_in_tests/default/clippy.toml
new file mode 100644
index 00000000000..1d13759aceb
--- /dev/null
+++ b/tests/ui-toml/check_incompatible_msrv_in_tests/default/clippy.toml
@@ -0,0 +1 @@
+# default config has check-incompatible-msrv-in-tests as false
diff --git a/tests/ui-toml/check_incompatible_msrv_in_tests/enabled/clippy.toml b/tests/ui-toml/check_incompatible_msrv_in_tests/enabled/clippy.toml
new file mode 100644
index 00000000000..c56af6c8218
--- /dev/null
+++ b/tests/ui-toml/check_incompatible_msrv_in_tests/enabled/clippy.toml
@@ -0,0 +1 @@
+check-incompatible-msrv-in-tests = true
diff --git a/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr b/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr
index 842059df1e9..acfe739277c 100644
--- a/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr
+++ b/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr
@@ -31,6 +31,7 @@ error: error reading Clippy's configuration file: unknown field `foobar`, expect
            await-holding-invalid-types
            blacklisted-names
            cargo-ignore-publish
+           check-incompatible-msrv-in-tests
            check-private-items
            cognitive-complexity-threshold
            cyclomatic-complexity-threshold
@@ -122,6 +123,7 @@ error: error reading Clippy's configuration file: unknown field `barfoo`, expect
            await-holding-invalid-types
            blacklisted-names
            cargo-ignore-publish
+           check-incompatible-msrv-in-tests
            check-private-items
            cognitive-complexity-threshold
            cyclomatic-complexity-threshold
@@ -213,6 +215,7 @@ error: error reading Clippy's configuration file: unknown field `allow_mixed_uni
            await-holding-invalid-types
            blacklisted-names
            cargo-ignore-publish
+           check-incompatible-msrv-in-tests
            check-private-items
            cognitive-complexity-threshold
            cyclomatic-complexity-threshold