about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarcel Hellwig <github@cookiesoft.de>2022-05-10 14:46:05 +0200
committerMarcel Hellwig <github@cookiesoft.de>2022-06-28 08:04:10 +0200
commitf0a1cd5645d6b72a621c8a80eebe72d363c00a4e (patch)
tree853f2d7960a1653703ff17cbb072e7b607981618
parent63847656655bda9fe3cb822b6f99d0268fabde03 (diff)
downloadrust-f0a1cd5645d6b72a621c8a80eebe72d363c00a4e.tar.gz
rust-f0a1cd5645d6b72a621c8a80eebe72d363c00a4e.zip
add uitests for cargo rust-version field
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_both_diff/Cargo.toml8
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_both_diff/clippy.toml1
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_both_diff/src/main.rs11
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_both_diff/src/main.stderr16
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_both_same/Cargo.toml8
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_both_same/clippy.toml1
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_both_same/src/main.rs11
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_both_same/src/main.stderr14
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_cargo/Cargo.toml8
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_cargo/src/main.rs11
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_cargo/src/main.stderr14
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_clippy/Cargo.toml7
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_clippy/clippy.toml1
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_clippy/src/main.rs11
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_clippy/src/main.stderr14
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_file_attr/Cargo.toml8
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_file_attr/clippy.toml1
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_file_attr/src/main.rs16
-rw-r--r--tests/ui-cargo/cargo_rust_version/fail_file_attr/src/main.stderr14
-rw-r--r--tests/ui-cargo/cargo_rust_version/pass_both_same/Cargo.toml8
-rw-r--r--tests/ui-cargo/cargo_rust_version/pass_both_same/clippy.toml1
-rw-r--r--tests/ui-cargo/cargo_rust_version/pass_both_same/src/main.rs11
-rw-r--r--tests/ui-cargo/cargo_rust_version/pass_cargo/Cargo.toml8
-rw-r--r--tests/ui-cargo/cargo_rust_version/pass_cargo/src/main.rs11
-rw-r--r--tests/ui-cargo/cargo_rust_version/pass_clippy/Cargo.toml7
-rw-r--r--tests/ui-cargo/cargo_rust_version/pass_clippy/clippy.toml1
-rw-r--r--tests/ui-cargo/cargo_rust_version/pass_clippy/src/main.rs11
-rw-r--r--tests/ui-cargo/cargo_rust_version/pass_file_attr/Cargo.toml8
-rw-r--r--tests/ui-cargo/cargo_rust_version/pass_file_attr/src/main.rs13
-rw-r--r--tests/ui-cargo/cargo_rust_version/warn_both_diff/Cargo.toml8
-rw-r--r--tests/ui-cargo/cargo_rust_version/warn_both_diff/clippy.toml1
-rw-r--r--tests/ui-cargo/cargo_rust_version/warn_both_diff/src/main.rs11
-rw-r--r--tests/ui-cargo/cargo_rust_version/warn_both_diff/src/main.stderr4
33 files changed, 278 insertions, 0 deletions
diff --git a/tests/ui-cargo/cargo_rust_version/fail_both_diff/Cargo.toml b/tests/ui-cargo/cargo_rust_version/fail_both_diff/Cargo.toml
new file mode 100644
index 00000000000..73ec29c5803
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_both_diff/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "fail-both-diff"
+version = "0.1.0"
+rust-version = "1.56"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/tests/ui-cargo/cargo_rust_version/fail_both_diff/clippy.toml b/tests/ui-cargo/cargo_rust_version/fail_both_diff/clippy.toml
new file mode 100644
index 00000000000..abe19b3a007
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_both_diff/clippy.toml
@@ -0,0 +1 @@
+msrv = "1.59"
diff --git a/tests/ui-cargo/cargo_rust_version/fail_both_diff/src/main.rs b/tests/ui-cargo/cargo_rust_version/fail_both_diff/src/main.rs
new file mode 100644
index 00000000000..5b91d550867
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_both_diff/src/main.rs
@@ -0,0 +1,11 @@
+#![deny(clippy::use_self)]
+
+pub struct Foo;
+
+impl Foo {
+    pub fn bar() -> Foo {
+        Foo
+    }
+}
+
+fn main() {}
diff --git a/tests/ui-cargo/cargo_rust_version/fail_both_diff/src/main.stderr b/tests/ui-cargo/cargo_rust_version/fail_both_diff/src/main.stderr
new file mode 100644
index 00000000000..9a7d802dc6d
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_both_diff/src/main.stderr
@@ -0,0 +1,16 @@
+warning: the MSRV in `clippy.toml` and `Cargo.toml` differ; using `1.59.0` from `clippy.toml`
+
+error: unnecessary structure name repetition
+  --> $DIR/main.rs:6:21
+   |
+LL |     pub fn bar() -> Foo {
+   |                     ^^^ help: use the applicable keyword: `Self`
+   |
+note: the lint level is defined here
+  --> $DIR/main.rs:1:9
+   |
+LL | #![deny(clippy::use_self)]
+   |         ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui-cargo/cargo_rust_version/fail_both_same/Cargo.toml b/tests/ui-cargo/cargo_rust_version/fail_both_same/Cargo.toml
new file mode 100644
index 00000000000..2d6d547e4fe
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_both_same/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "fail-both-same"
+version = "0.1.0"
+rust-version = "1.57.0"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/tests/ui-cargo/cargo_rust_version/fail_both_same/clippy.toml b/tests/ui-cargo/cargo_rust_version/fail_both_same/clippy.toml
new file mode 100644
index 00000000000..5cccb362c14
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_both_same/clippy.toml
@@ -0,0 +1 @@
+msrv = "1.57"
diff --git a/tests/ui-cargo/cargo_rust_version/fail_both_same/src/main.rs b/tests/ui-cargo/cargo_rust_version/fail_both_same/src/main.rs
new file mode 100644
index 00000000000..5b91d550867
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_both_same/src/main.rs
@@ -0,0 +1,11 @@
+#![deny(clippy::use_self)]
+
+pub struct Foo;
+
+impl Foo {
+    pub fn bar() -> Foo {
+        Foo
+    }
+}
+
+fn main() {}
diff --git a/tests/ui-cargo/cargo_rust_version/fail_both_same/src/main.stderr b/tests/ui-cargo/cargo_rust_version/fail_both_same/src/main.stderr
new file mode 100644
index 00000000000..a280e1bacdf
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_both_same/src/main.stderr
@@ -0,0 +1,14 @@
+error: unnecessary structure name repetition
+  --> $DIR/main.rs:6:21
+   |
+LL |     pub fn bar() -> Foo {
+   |                     ^^^ help: use the applicable keyword: `Self`
+   |
+note: the lint level is defined here
+  --> $DIR/main.rs:1:9
+   |
+LL | #![deny(clippy::use_self)]
+   |         ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui-cargo/cargo_rust_version/fail_cargo/Cargo.toml b/tests/ui-cargo/cargo_rust_version/fail_cargo/Cargo.toml
new file mode 100644
index 00000000000..36a53bd829d
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_cargo/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "fail-cargo"
+version = "0.1.0"
+rust-version = "1.56.1"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/tests/ui-cargo/cargo_rust_version/fail_cargo/src/main.rs b/tests/ui-cargo/cargo_rust_version/fail_cargo/src/main.rs
new file mode 100644
index 00000000000..5b91d550867
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_cargo/src/main.rs
@@ -0,0 +1,11 @@
+#![deny(clippy::use_self)]
+
+pub struct Foo;
+
+impl Foo {
+    pub fn bar() -> Foo {
+        Foo
+    }
+}
+
+fn main() {}
diff --git a/tests/ui-cargo/cargo_rust_version/fail_cargo/src/main.stderr b/tests/ui-cargo/cargo_rust_version/fail_cargo/src/main.stderr
new file mode 100644
index 00000000000..a280e1bacdf
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_cargo/src/main.stderr
@@ -0,0 +1,14 @@
+error: unnecessary structure name repetition
+  --> $DIR/main.rs:6:21
+   |
+LL |     pub fn bar() -> Foo {
+   |                     ^^^ help: use the applicable keyword: `Self`
+   |
+note: the lint level is defined here
+  --> $DIR/main.rs:1:9
+   |
+LL | #![deny(clippy::use_self)]
+   |         ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui-cargo/cargo_rust_version/fail_clippy/Cargo.toml b/tests/ui-cargo/cargo_rust_version/fail_clippy/Cargo.toml
new file mode 100644
index 00000000000..9f644a1a39a
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_clippy/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "fail-clippy"
+version = "0.1.0"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/tests/ui-cargo/cargo_rust_version/fail_clippy/clippy.toml b/tests/ui-cargo/cargo_rust_version/fail_clippy/clippy.toml
new file mode 100644
index 00000000000..ddbdbc1fa25
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_clippy/clippy.toml
@@ -0,0 +1 @@
+msrv = "1.58"
diff --git a/tests/ui-cargo/cargo_rust_version/fail_clippy/src/main.rs b/tests/ui-cargo/cargo_rust_version/fail_clippy/src/main.rs
new file mode 100644
index 00000000000..5b91d550867
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_clippy/src/main.rs
@@ -0,0 +1,11 @@
+#![deny(clippy::use_self)]
+
+pub struct Foo;
+
+impl Foo {
+    pub fn bar() -> Foo {
+        Foo
+    }
+}
+
+fn main() {}
diff --git a/tests/ui-cargo/cargo_rust_version/fail_clippy/src/main.stderr b/tests/ui-cargo/cargo_rust_version/fail_clippy/src/main.stderr
new file mode 100644
index 00000000000..a280e1bacdf
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_clippy/src/main.stderr
@@ -0,0 +1,14 @@
+error: unnecessary structure name repetition
+  --> $DIR/main.rs:6:21
+   |
+LL |     pub fn bar() -> Foo {
+   |                     ^^^ help: use the applicable keyword: `Self`
+   |
+note: the lint level is defined here
+  --> $DIR/main.rs:1:9
+   |
+LL | #![deny(clippy::use_self)]
+   |         ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui-cargo/cargo_rust_version/fail_file_attr/Cargo.toml b/tests/ui-cargo/cargo_rust_version/fail_file_attr/Cargo.toml
new file mode 100644
index 00000000000..5380e993b29
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_file_attr/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "fail-file-attr"
+version = "0.1.0"
+rust-version = "1.13"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/tests/ui-cargo/cargo_rust_version/fail_file_attr/clippy.toml b/tests/ui-cargo/cargo_rust_version/fail_file_attr/clippy.toml
new file mode 100644
index 00000000000..ea5d806594b
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_file_attr/clippy.toml
@@ -0,0 +1 @@
+msrv = "1.13.0"
diff --git a/tests/ui-cargo/cargo_rust_version/fail_file_attr/src/main.rs b/tests/ui-cargo/cargo_rust_version/fail_file_attr/src/main.rs
new file mode 100644
index 00000000000..bcbffa82a54
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_file_attr/src/main.rs
@@ -0,0 +1,16 @@
+// FIXME: this should produce a warning, because the attribute says 1.58 and the cargo.toml file
+// says 1.13
+
+#![feature(custom_inner_attributes)]
+#![clippy::msrv = "1.58.0"]
+#![deny(clippy::use_self)]
+
+pub struct Foo;
+
+impl Foo {
+    pub fn bar() -> Foo {
+        Foo
+    }
+}
+
+fn main() {}
diff --git a/tests/ui-cargo/cargo_rust_version/fail_file_attr/src/main.stderr b/tests/ui-cargo/cargo_rust_version/fail_file_attr/src/main.stderr
new file mode 100644
index 00000000000..88f6e00922b
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/fail_file_attr/src/main.stderr
@@ -0,0 +1,14 @@
+error: unnecessary structure name repetition
+  --> $DIR/main.rs:11:21
+   |
+LL |     pub fn bar() -> Foo {
+   |                     ^^^ help: use the applicable keyword: `Self`
+   |
+note: the lint level is defined here
+  --> $DIR/main.rs:6:9
+   |
+LL | #![deny(clippy::use_self)]
+   |         ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui-cargo/cargo_rust_version/pass_both_same/Cargo.toml b/tests/ui-cargo/cargo_rust_version/pass_both_same/Cargo.toml
new file mode 100644
index 00000000000..1f9bd8f9a84
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/pass_both_same/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "fail-both-same"
+version = "0.1.0"
+rust-version = "1.13.0"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/tests/ui-cargo/cargo_rust_version/pass_both_same/clippy.toml b/tests/ui-cargo/cargo_rust_version/pass_both_same/clippy.toml
new file mode 100644
index 00000000000..5e8e48b636b
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/pass_both_same/clippy.toml
@@ -0,0 +1 @@
+msrv = "1.13"
diff --git a/tests/ui-cargo/cargo_rust_version/pass_both_same/src/main.rs b/tests/ui-cargo/cargo_rust_version/pass_both_same/src/main.rs
new file mode 100644
index 00000000000..5b91d550867
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/pass_both_same/src/main.rs
@@ -0,0 +1,11 @@
+#![deny(clippy::use_self)]
+
+pub struct Foo;
+
+impl Foo {
+    pub fn bar() -> Foo {
+        Foo
+    }
+}
+
+fn main() {}
diff --git a/tests/ui-cargo/cargo_rust_version/pass_cargo/Cargo.toml b/tests/ui-cargo/cargo_rust_version/pass_cargo/Cargo.toml
new file mode 100644
index 00000000000..77538027c0f
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/pass_cargo/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "fail-cargo"
+version = "0.1.0"
+rust-version = "1.13.0"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/tests/ui-cargo/cargo_rust_version/pass_cargo/src/main.rs b/tests/ui-cargo/cargo_rust_version/pass_cargo/src/main.rs
new file mode 100644
index 00000000000..5b91d550867
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/pass_cargo/src/main.rs
@@ -0,0 +1,11 @@
+#![deny(clippy::use_self)]
+
+pub struct Foo;
+
+impl Foo {
+    pub fn bar() -> Foo {
+        Foo
+    }
+}
+
+fn main() {}
diff --git a/tests/ui-cargo/cargo_rust_version/pass_clippy/Cargo.toml b/tests/ui-cargo/cargo_rust_version/pass_clippy/Cargo.toml
new file mode 100644
index 00000000000..9f644a1a39a
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/pass_clippy/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "fail-clippy"
+version = "0.1.0"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/tests/ui-cargo/cargo_rust_version/pass_clippy/clippy.toml b/tests/ui-cargo/cargo_rust_version/pass_clippy/clippy.toml
new file mode 100644
index 00000000000..5e8e48b636b
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/pass_clippy/clippy.toml
@@ -0,0 +1 @@
+msrv = "1.13"
diff --git a/tests/ui-cargo/cargo_rust_version/pass_clippy/src/main.rs b/tests/ui-cargo/cargo_rust_version/pass_clippy/src/main.rs
new file mode 100644
index 00000000000..5b91d550867
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/pass_clippy/src/main.rs
@@ -0,0 +1,11 @@
+#![deny(clippy::use_self)]
+
+pub struct Foo;
+
+impl Foo {
+    pub fn bar() -> Foo {
+        Foo
+    }
+}
+
+fn main() {}
diff --git a/tests/ui-cargo/cargo_rust_version/pass_file_attr/Cargo.toml b/tests/ui-cargo/cargo_rust_version/pass_file_attr/Cargo.toml
new file mode 100644
index 00000000000..f0387cd90b8
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/pass_file_attr/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "fail-file-attr"
+version = "0.1.0"
+rust-version = "1.59"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/tests/ui-cargo/cargo_rust_version/pass_file_attr/src/main.rs b/tests/ui-cargo/cargo_rust_version/pass_file_attr/src/main.rs
new file mode 100644
index 00000000000..27fe4771d2d
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/pass_file_attr/src/main.rs
@@ -0,0 +1,13 @@
+#![feature(custom_inner_attributes)]
+#![clippy::msrv = "1.13.0"]
+#![deny(clippy::use_self)]
+
+pub struct Foo;
+
+impl Foo {
+    pub fn bar() -> Foo {
+        Foo
+    }
+}
+
+fn main() {}
diff --git a/tests/ui-cargo/cargo_rust_version/warn_both_diff/Cargo.toml b/tests/ui-cargo/cargo_rust_version/warn_both_diff/Cargo.toml
new file mode 100644
index 00000000000..a19d5b33fe5
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/warn_both_diff/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "warn-both-diff"
+version = "0.1.0"
+rust-version = "1.56.0"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/tests/ui-cargo/cargo_rust_version/warn_both_diff/clippy.toml b/tests/ui-cargo/cargo_rust_version/warn_both_diff/clippy.toml
new file mode 100644
index 00000000000..5e8e48b636b
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/warn_both_diff/clippy.toml
@@ -0,0 +1 @@
+msrv = "1.13"
diff --git a/tests/ui-cargo/cargo_rust_version/warn_both_diff/src/main.rs b/tests/ui-cargo/cargo_rust_version/warn_both_diff/src/main.rs
new file mode 100644
index 00000000000..5b91d550867
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/warn_both_diff/src/main.rs
@@ -0,0 +1,11 @@
+#![deny(clippy::use_self)]
+
+pub struct Foo;
+
+impl Foo {
+    pub fn bar() -> Foo {
+        Foo
+    }
+}
+
+fn main() {}
diff --git a/tests/ui-cargo/cargo_rust_version/warn_both_diff/src/main.stderr b/tests/ui-cargo/cargo_rust_version/warn_both_diff/src/main.stderr
new file mode 100644
index 00000000000..eeae5b7b275
--- /dev/null
+++ b/tests/ui-cargo/cargo_rust_version/warn_both_diff/src/main.stderr
@@ -0,0 +1,4 @@
+warning: the MSRV in `clippy.toml` and `Cargo.toml` differ; using `1.13.0` from `clippy.toml`
+
+warning: 1 warning emitted
+