summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui-toml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/tools/clippy/tests/ui-toml
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/clippy/tests/ui-toml')
-rw-r--r--src/tools/clippy/tests/ui-toml/arithmetic_allowed/arithmetic_allowed.rs24
-rw-r--r--src/tools/clippy/tests/ui-toml/arithmetic_allowed/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs41
-rw-r--r--src/tools/clippy/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr25
-rw-r--r--src/tools/clippy/tests/ui-toml/await_holding_invalid_type/clippy.toml4
-rw-r--r--src/tools/clippy/tests/ui-toml/bad_toml/clippy.toml2
-rw-r--r--src/tools/clippy/tests/ui-toml/bad_toml/conf_bad_toml.rs1
-rw-r--r--src/tools/clippy/tests/ui-toml/bad_toml/conf_bad_toml.stderr4
-rw-r--r--src/tools/clippy/tests/ui-toml/bad_toml_type/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/bad_toml_type/conf_bad_type.rs1
-rw-r--r--src/tools/clippy/tests/ui-toml/bad_toml_type/conf_bad_type.stderr4
-rw-r--r--src/tools/clippy/tests/ui-toml/blacklisted_names_append/blacklisted_names.rs10
-rw-r--r--src/tools/clippy/tests/ui-toml/blacklisted_names_append/blacklisted_names.stderr16
-rw-r--r--src/tools/clippy/tests/ui-toml/blacklisted_names_append/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/blacklisted_names_replace/blacklisted_names.rs10
-rw-r--r--src/tools/clippy/tests/ui-toml/blacklisted_names_replace/blacklisted_names.stderr10
-rw-r--r--src/tools/clippy/tests/ui-toml/blacklisted_names_replace/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/conf_deprecated_key/clippy.toml6
-rw-r--r--src/tools/clippy/tests/ui-toml/conf_deprecated_key/conf_deprecated_key.rs1
-rw-r--r--src/tools/clippy/tests/ui-toml/conf_deprecated_key/conf_deprecated_key.stderr4
-rw-r--r--src/tools/clippy/tests/ui-toml/dbg_macro/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.rs39
-rw-r--r--src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.stderr102
-rw-r--r--src/tools/clippy/tests/ui-toml/doc_valid_idents_append/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/doc_valid_idents_append/doc_markdown.rs12
-rw-r--r--src/tools/clippy/tests/ui-toml/doc_valid_idents_append/doc_markdown.stderr14
-rw-r--r--src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/doc_markdown.rs12
-rw-r--r--src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/doc_markdown.stderr36
-rw-r--r--src/tools/clippy/tests/ui-toml/expect_used/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/expect_used/expect_used.rs29
-rw-r--r--src/tools/clippy/tests/ui-toml/expect_used/expect_used.stderr19
-rw-r--r--src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/test.rs6
-rw-r--r--src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/test.stderr11
-rw-r--r--src/tools/clippy/tests/ui-toml/functions_maxlines/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/functions_maxlines/test.rs60
-rw-r--r--src/tools/clippy/tests/ui-toml/functions_maxlines/test.stderr43
-rw-r--r--src/tools/clippy/tests/ui-toml/good_toml_no_false_negatives/clippy.toml3
-rw-r--r--src/tools/clippy/tests/ui-toml/good_toml_no_false_negatives/conf_no_false_negatives.rs1
-rw-r--r--src/tools/clippy/tests/ui-toml/invalid_min_rust_version/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/invalid_min_rust_version/invalid_min_rust_version.rs3
-rw-r--r--src/tools/clippy/tests/ui-toml/invalid_min_rust_version/invalid_min_rust_version.stderr4
-rw-r--r--src/tools/clippy/tests/ui-toml/large_include_file/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/large_include_file/large_include_file.rs16
-rw-r--r--src/tools/clippy/tests/ui-toml/large_include_file/large_include_file.stderr21
-rw-r--r--src/tools/clippy/tests/ui-toml/large_include_file/too_big.txt1
-rw-r--r--src/tools/clippy/tests/ui-toml/lint_decimal_readability/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.rs23
-rw-r--r--src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.stderr10
-rw-r--r--src/tools/clippy/tests/ui-toml/max_suggested_slice_pattern_length/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs23
-rw-r--r--src/tools/clippy/tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.stderr22
-rw-r--r--src/tools/clippy/tests/ui-toml/min_rust_version/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.rs98
-rw-r--r--src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.stderr10
-rw-r--r--src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/clippy.toml10
-rw-r--r--src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs16
-rw-r--r--src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.stderr40
-rw-r--r--src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/auxiliary/proc_macro_derive.rs18
-rw-r--r--src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/clippy.toml6
-rw-r--r--src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs60
-rw-r--r--src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.stderr94
-rw-r--r--src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/test.rs43
-rw-r--r--src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/test.stderr91
-rw-r--r--src/tools/clippy/tests/ui-toml/struct_excessive_bools/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/struct_excessive_bools/test.rs9
-rw-r--r--src/tools/clippy/tests/ui-toml/struct_excessive_bools/test.stderr13
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_blacklist/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.rs20
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.stderr46
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_disallowed_methods/clippy.toml10
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs23
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.stderr54
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_disallowed_types/clippy.toml15
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_disallowed_types/conf_disallowed_types.rs42
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_disallowed_types/conf_disallowed_types.stderr132
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_trivially_copy/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.rs20
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.stderr20
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_unknown_key/clippy.toml6
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.rs1
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr45
-rw-r--r--src/tools/clippy/tests/ui-toml/unwrap_used/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.rs73
-rw-r--r--src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr197
-rwxr-xr-xsrc/tools/clippy/tests/ui-toml/update-all-references.sh3
-rw-r--r--src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs44
-rw-r--r--src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr82
-rw-r--r--src/tools/clippy/tests/ui-toml/vec_box_sized/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/vec_box_sized/test.rs15
-rw-r--r--src/tools/clippy/tests/ui-toml/vec_box_sized/test.stderr22
-rw-r--r--src/tools/clippy/tests/ui-toml/zero_single_char_names/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/zero_single_char_names/zero_single_char_names.rs3
96 files changed, 2077 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui-toml/arithmetic_allowed/arithmetic_allowed.rs b/src/tools/clippy/tests/ui-toml/arithmetic_allowed/arithmetic_allowed.rs
new file mode 100644
index 000000000..195fabdbf
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/arithmetic_allowed/arithmetic_allowed.rs
@@ -0,0 +1,24 @@
+#![warn(clippy::arithmetic)]
+
+use core::ops::Add;
+
+#[derive(Clone, Copy)]
+struct Point {
+ x: i32,
+ y: i32,
+}
+
+impl Add for Point {
+ type Output = Self;
+
+ fn add(self, other: Self) -> Self {
+ todo!()
+ }
+}
+
+fn main() {
+ let _ = Point { x: 1, y: 0 } + Point { x: 2, y: 3 };
+
+ let point: Point = Point { x: 1, y: 0 };
+ let _ = point + point;
+}
diff --git a/src/tools/clippy/tests/ui-toml/arithmetic_allowed/clippy.toml b/src/tools/clippy/tests/ui-toml/arithmetic_allowed/clippy.toml
new file mode 100644
index 000000000..cc40570b1
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/arithmetic_allowed/clippy.toml
@@ -0,0 +1 @@
+arithmetic-allowed = ["Point"]
diff --git a/src/tools/clippy/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs b/src/tools/clippy/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs
new file mode 100644
index 000000000..fbef5c456
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs
@@ -0,0 +1,41 @@
+#![warn(clippy::await_holding_invalid_type)]
+use std::net::Ipv4Addr;
+
+async fn bad() -> u32 {
+ let _x = String::from("hello");
+ baz().await
+}
+
+async fn bad_reason() -> u32 {
+ let _x = Ipv4Addr::new(127, 0, 0, 1);
+ baz().await
+}
+
+async fn good() -> u32 {
+ {
+ let _x = String::from("hi!");
+ let _y = Ipv4Addr::new(127, 0, 0, 1);
+ }
+ baz().await;
+ let _x = String::from("hi!");
+ 47
+}
+
+async fn baz() -> u32 {
+ 42
+}
+
+#[allow(clippy::manual_async_fn)]
+fn block_bad() -> impl std::future::Future<Output = u32> {
+ async move {
+ let _x = String::from("hi!");
+ baz().await
+ }
+}
+
+fn main() {
+ good();
+ bad();
+ bad_reason();
+ block_bad();
+}
diff --git a/src/tools/clippy/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr b/src/tools/clippy/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr
new file mode 100644
index 000000000..62c45b546
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr
@@ -0,0 +1,25 @@
+error: `std::string::String` may not be held across an `await` point per `clippy.toml`
+ --> $DIR/await_holding_invalid_type.rs:5:9
+ |
+LL | let _x = String::from("hello");
+ | ^^
+ |
+ = note: `-D clippy::await-holding-invalid-type` implied by `-D warnings`
+ = note: strings are bad
+
+error: `std::net::Ipv4Addr` may not be held across an `await` point per `clippy.toml`
+ --> $DIR/await_holding_invalid_type.rs:10:9
+ |
+LL | let _x = Ipv4Addr::new(127, 0, 0, 1);
+ | ^^
+
+error: `std::string::String` may not be held across an `await` point per `clippy.toml`
+ --> $DIR/await_holding_invalid_type.rs:31:13
+ |
+LL | let _x = String::from("hi!");
+ | ^^
+ |
+ = note: strings are bad
+
+error: aborting due to 3 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/await_holding_invalid_type/clippy.toml b/src/tools/clippy/tests/ui-toml/await_holding_invalid_type/clippy.toml
new file mode 100644
index 000000000..79990096b
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/await_holding_invalid_type/clippy.toml
@@ -0,0 +1,4 @@
+await-holding-invalid-types = [
+ { path = "std::string::String", reason = "strings are bad" },
+ "std::net::Ipv4Addr",
+]
diff --git a/src/tools/clippy/tests/ui-toml/bad_toml/clippy.toml b/src/tools/clippy/tests/ui-toml/bad_toml/clippy.toml
new file mode 100644
index 000000000..823e01a33
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/bad_toml/clippy.toml
@@ -0,0 +1,2 @@
+fn this_is_obviously(not: a, toml: file) {
+}
diff --git a/src/tools/clippy/tests/ui-toml/bad_toml/conf_bad_toml.rs b/src/tools/clippy/tests/ui-toml/bad_toml/conf_bad_toml.rs
new file mode 100644
index 000000000..f328e4d9d
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/bad_toml/conf_bad_toml.rs
@@ -0,0 +1 @@
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/bad_toml/conf_bad_toml.stderr b/src/tools/clippy/tests/ui-toml/bad_toml/conf_bad_toml.stderr
new file mode 100644
index 000000000..28c1a568a
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/bad_toml/conf_bad_toml.stderr
@@ -0,0 +1,4 @@
+error: error reading Clippy's configuration file `$DIR/clippy.toml`: expected an equals, found an identifier at line 1 column 4
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/bad_toml_type/clippy.toml b/src/tools/clippy/tests/ui-toml/bad_toml_type/clippy.toml
new file mode 100644
index 000000000..168675394
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/bad_toml_type/clippy.toml
@@ -0,0 +1 @@
+blacklisted-names = 42
diff --git a/src/tools/clippy/tests/ui-toml/bad_toml_type/conf_bad_type.rs b/src/tools/clippy/tests/ui-toml/bad_toml_type/conf_bad_type.rs
new file mode 100644
index 000000000..f328e4d9d
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/bad_toml_type/conf_bad_type.rs
@@ -0,0 +1 @@
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/bad_toml_type/conf_bad_type.stderr b/src/tools/clippy/tests/ui-toml/bad_toml_type/conf_bad_type.stderr
new file mode 100644
index 000000000..c7bc261de
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/bad_toml_type/conf_bad_type.stderr
@@ -0,0 +1,4 @@
+error: error reading Clippy's configuration file `$DIR/clippy.toml`: invalid type: integer `42`, expected a sequence for key `blacklisted-names`
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/blacklisted_names_append/blacklisted_names.rs b/src/tools/clippy/tests/ui-toml/blacklisted_names_append/blacklisted_names.rs
new file mode 100644
index 000000000..fb2395cf9
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/blacklisted_names_append/blacklisted_names.rs
@@ -0,0 +1,10 @@
+#[warn(clippy::blacklisted_name)]
+
+fn main() {
+ // `foo` is part of the default configuration
+ let foo = "bar";
+ // `ducks` was unrightfully blacklisted
+ let ducks = ["quack", "quack"];
+ // `fox` is okay
+ let fox = ["what", "does", "the", "fox", "say", "?"];
+}
diff --git a/src/tools/clippy/tests/ui-toml/blacklisted_names_append/blacklisted_names.stderr b/src/tools/clippy/tests/ui-toml/blacklisted_names_append/blacklisted_names.stderr
new file mode 100644
index 000000000..9169bb0e8
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/blacklisted_names_append/blacklisted_names.stderr
@@ -0,0 +1,16 @@
+error: use of a blacklisted/placeholder name `foo`
+ --> $DIR/blacklisted_names.rs:5:9
+ |
+LL | let foo = "bar";
+ | ^^^
+ |
+ = note: `-D clippy::blacklisted-name` implied by `-D warnings`
+
+error: use of a blacklisted/placeholder name `ducks`
+ --> $DIR/blacklisted_names.rs:7:9
+ |
+LL | let ducks = ["quack", "quack"];
+ | ^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/blacklisted_names_append/clippy.toml b/src/tools/clippy/tests/ui-toml/blacklisted_names_append/clippy.toml
new file mode 100644
index 000000000..0e052ef50
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/blacklisted_names_append/clippy.toml
@@ -0,0 +1 @@
+blacklisted-names = ["ducks", ".."]
diff --git a/src/tools/clippy/tests/ui-toml/blacklisted_names_replace/blacklisted_names.rs b/src/tools/clippy/tests/ui-toml/blacklisted_names_replace/blacklisted_names.rs
new file mode 100644
index 000000000..fb2395cf9
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/blacklisted_names_replace/blacklisted_names.rs
@@ -0,0 +1,10 @@
+#[warn(clippy::blacklisted_name)]
+
+fn main() {
+ // `foo` is part of the default configuration
+ let foo = "bar";
+ // `ducks` was unrightfully blacklisted
+ let ducks = ["quack", "quack"];
+ // `fox` is okay
+ let fox = ["what", "does", "the", "fox", "say", "?"];
+}
diff --git a/src/tools/clippy/tests/ui-toml/blacklisted_names_replace/blacklisted_names.stderr b/src/tools/clippy/tests/ui-toml/blacklisted_names_replace/blacklisted_names.stderr
new file mode 100644
index 000000000..ec6f7f084
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/blacklisted_names_replace/blacklisted_names.stderr
@@ -0,0 +1,10 @@
+error: use of a blacklisted/placeholder name `ducks`
+ --> $DIR/blacklisted_names.rs:7:9
+ |
+LL | let ducks = ["quack", "quack"];
+ | ^^^^^
+ |
+ = note: `-D clippy::blacklisted-name` implied by `-D warnings`
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/blacklisted_names_replace/clippy.toml b/src/tools/clippy/tests/ui-toml/blacklisted_names_replace/clippy.toml
new file mode 100644
index 000000000..4582f1c06
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/blacklisted_names_replace/clippy.toml
@@ -0,0 +1 @@
+blacklisted-names = ["ducks"]
diff --git a/src/tools/clippy/tests/ui-toml/conf_deprecated_key/clippy.toml b/src/tools/clippy/tests/ui-toml/conf_deprecated_key/clippy.toml
new file mode 100644
index 000000000..ac47b1950
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/conf_deprecated_key/clippy.toml
@@ -0,0 +1,6 @@
+# that one is an error
+cyclomatic-complexity-threshold = 42
+
+# that one is white-listed
+[third-party]
+clippy-feature = "nightly"
diff --git a/src/tools/clippy/tests/ui-toml/conf_deprecated_key/conf_deprecated_key.rs b/src/tools/clippy/tests/ui-toml/conf_deprecated_key/conf_deprecated_key.rs
new file mode 100644
index 000000000..f328e4d9d
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/conf_deprecated_key/conf_deprecated_key.rs
@@ -0,0 +1 @@
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/conf_deprecated_key/conf_deprecated_key.stderr b/src/tools/clippy/tests/ui-toml/conf_deprecated_key/conf_deprecated_key.stderr
new file mode 100644
index 000000000..90021a034
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/conf_deprecated_key/conf_deprecated_key.stderr
@@ -0,0 +1,4 @@
+error: error reading Clippy's configuration file `$DIR/clippy.toml`: deprecated field `cyclomatic-complexity-threshold`. Please use `cognitive-complexity-threshold` instead
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/dbg_macro/clippy.toml b/src/tools/clippy/tests/ui-toml/dbg_macro/clippy.toml
new file mode 100644
index 000000000..4296655a0
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/dbg_macro/clippy.toml
@@ -0,0 +1 @@
+allow-dbg-in-tests = true
diff --git a/src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.rs b/src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.rs
new file mode 100644
index 000000000..5d9ce18f6
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.rs
@@ -0,0 +1,39 @@
+// compile-flags: --test
+#![warn(clippy::dbg_macro)]
+
+fn foo(n: u32) -> u32 {
+ if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
+}
+
+fn factorial(n: u32) -> u32 {
+ if dbg!(n <= 1) {
+ dbg!(1)
+ } else {
+ dbg!(n * factorial(n - 1))
+ }
+}
+
+fn main() {
+ dbg!(42);
+ dbg!(dbg!(dbg!(42)));
+ foo(3) + dbg!(factorial(4));
+ dbg!(1, 2, dbg!(3, 4));
+ dbg!(1, 2, 3, 4, 5);
+}
+
+#[test]
+pub fn issue8481() {
+ dbg!(1);
+}
+
+#[cfg(test)]
+fn foo2() {
+ dbg!(1);
+}
+
+#[cfg(test)]
+mod mod1 {
+ fn func() {
+ dbg!(1);
+ }
+}
diff --git a/src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.stderr b/src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.stderr
new file mode 100644
index 000000000..46efb86dc
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.stderr
@@ -0,0 +1,102 @@
+error: `dbg!` macro is intended as a debugging tool
+ --> $DIR/dbg_macro.rs:5:22
+ |
+LL | if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::dbg-macro` implied by `-D warnings`
+help: ensure to avoid having uses of it in version control
+ |
+LL | if let Some(n) = n.checked_sub(4) { n } else { n }
+ | ~~~~~~~~~~~~~~~~
+
+error: `dbg!` macro is intended as a debugging tool
+ --> $DIR/dbg_macro.rs:9:8
+ |
+LL | if dbg!(n <= 1) {
+ | ^^^^^^^^^^^^
+ |
+help: ensure to avoid having uses of it in version control
+ |
+LL | if n <= 1 {
+ | ~~~~~~
+
+error: `dbg!` macro is intended as a debugging tool
+ --> $DIR/dbg_macro.rs:10:9
+ |
+LL | dbg!(1)
+ | ^^^^^^^
+ |
+help: ensure to avoid having uses of it in version control
+ |
+LL | 1
+ |
+
+error: `dbg!` macro is intended as a debugging tool
+ --> $DIR/dbg_macro.rs:12:9
+ |
+LL | dbg!(n * factorial(n - 1))
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: ensure to avoid having uses of it in version control
+ |
+LL | n * factorial(n - 1)
+ |
+
+error: `dbg!` macro is intended as a debugging tool
+ --> $DIR/dbg_macro.rs:17:5
+ |
+LL | dbg!(42);
+ | ^^^^^^^^
+ |
+help: ensure to avoid having uses of it in version control
+ |
+LL | 42;
+ | ~~
+
+error: `dbg!` macro is intended as a debugging tool
+ --> $DIR/dbg_macro.rs:18:5
+ |
+LL | dbg!(dbg!(dbg!(42)));
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+help: ensure to avoid having uses of it in version control
+ |
+LL | dbg!(dbg!(42));
+ | ~~~~~~~~~~~~~~
+
+error: `dbg!` macro is intended as a debugging tool
+ --> $DIR/dbg_macro.rs:19:14
+ |
+LL | foo(3) + dbg!(factorial(4));
+ | ^^^^^^^^^^^^^^^^^^
+ |
+help: ensure to avoid having uses of it in version control
+ |
+LL | foo(3) + factorial(4);
+ | ~~~~~~~~~~~~
+
+error: `dbg!` macro is intended as a debugging tool
+ --> $DIR/dbg_macro.rs:20:5
+ |
+LL | dbg!(1, 2, dbg!(3, 4));
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: ensure to avoid having uses of it in version control
+ |
+LL | (1, 2, dbg!(3, 4));
+ | ~~~~~~~~~~~~~~~~~~
+
+error: `dbg!` macro is intended as a debugging tool
+ --> $DIR/dbg_macro.rs:21:5
+ |
+LL | dbg!(1, 2, 3, 4, 5);
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+help: ensure to avoid having uses of it in version control
+ |
+LL | (1, 2, 3, 4, 5);
+ | ~~~~~~~~~~~~~~~
+
+error: aborting due to 9 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/clippy.toml b/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/clippy.toml
new file mode 100644
index 000000000..daf327685
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/clippy.toml
@@ -0,0 +1 @@
+doc-valid-idents = ["ClipPy", ".."]
diff --git a/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/doc_markdown.rs b/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/doc_markdown.rs
new file mode 100644
index 000000000..327a592e9
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/doc_markdown.rs
@@ -0,0 +1,12 @@
+#![warn(clippy::doc_markdown)]
+
+/// This is a special interface for ClipPy which doesn't require backticks
+fn allowed_name() {}
+
+/// OAuth and LaTeX are inside Clippy's default list.
+fn default_name() {}
+
+/// TestItemThingyOfCoolness might sound cool but is not on the list and should be linted.
+fn unknown_name() {}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/doc_markdown.stderr b/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/doc_markdown.stderr
new file mode 100644
index 000000000..0f767c9b8
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/doc_markdown.stderr
@@ -0,0 +1,14 @@
+error: item in documentation is missing backticks
+ --> $DIR/doc_markdown.rs:9:5
+ |
+LL | /// TestItemThingyOfCoolness might sound cool but is not on the list and should be linted.
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::doc-markdown` implied by `-D warnings`
+help: try
+ |
+LL | /// `TestItemThingyOfCoolness` might sound cool but is not on the list and should be linted.
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/clippy.toml b/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/clippy.toml
new file mode 100644
index 000000000..70bc477b0
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/clippy.toml
@@ -0,0 +1 @@
+doc-valid-idents = ["ClipPy"]
diff --git a/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/doc_markdown.rs b/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/doc_markdown.rs
new file mode 100644
index 000000000..327a592e9
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/doc_markdown.rs
@@ -0,0 +1,12 @@
+#![warn(clippy::doc_markdown)]
+
+/// This is a special interface for ClipPy which doesn't require backticks
+fn allowed_name() {}
+
+/// OAuth and LaTeX are inside Clippy's default list.
+fn default_name() {}
+
+/// TestItemThingyOfCoolness might sound cool but is not on the list and should be linted.
+fn unknown_name() {}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/doc_markdown.stderr b/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/doc_markdown.stderr
new file mode 100644
index 000000000..e0613eb86
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/doc_markdown.stderr
@@ -0,0 +1,36 @@
+error: item in documentation is missing backticks
+ --> $DIR/doc_markdown.rs:6:5
+ |
+LL | /// OAuth and LaTeX are inside Clippy's default list.
+ | ^^^^^
+ |
+ = note: `-D clippy::doc-markdown` implied by `-D warnings`
+help: try
+ |
+LL | /// `OAuth` and LaTeX are inside Clippy's default list.
+ | ~~~~~~~
+
+error: item in documentation is missing backticks
+ --> $DIR/doc_markdown.rs:6:15
+ |
+LL | /// OAuth and LaTeX are inside Clippy's default list.
+ | ^^^^^
+ |
+help: try
+ |
+LL | /// OAuth and `LaTeX` are inside Clippy's default list.
+ | ~~~~~~~
+
+error: item in documentation is missing backticks
+ --> $DIR/doc_markdown.rs:9:5
+ |
+LL | /// TestItemThingyOfCoolness might sound cool but is not on the list and should be linted.
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: try
+ |
+LL | /// `TestItemThingyOfCoolness` might sound cool but is not on the list and should be linted.
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to 3 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/expect_used/clippy.toml b/src/tools/clippy/tests/ui-toml/expect_used/clippy.toml
new file mode 100644
index 000000000..6933b8164
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/expect_used/clippy.toml
@@ -0,0 +1 @@
+allow-expect-in-tests = true
diff --git a/src/tools/clippy/tests/ui-toml/expect_used/expect_used.rs b/src/tools/clippy/tests/ui-toml/expect_used/expect_used.rs
new file mode 100644
index 000000000..22dcd3ae9
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/expect_used/expect_used.rs
@@ -0,0 +1,29 @@
+// compile-flags: --test
+#![warn(clippy::expect_used)]
+
+fn expect_option() {
+ let opt = Some(0);
+ let _ = opt.expect("");
+}
+
+fn expect_result() {
+ let res: Result<u8, ()> = Ok(0);
+ let _ = res.expect("");
+}
+
+fn main() {
+ expect_option();
+ expect_result();
+}
+
+#[test]
+fn test_expect_option() {
+ let opt = Some(0);
+ let _ = opt.expect("");
+}
+
+#[test]
+fn test_expect_result() {
+ let res: Result<u8, ()> = Ok(0);
+ let _ = res.expect("");
+}
diff --git a/src/tools/clippy/tests/ui-toml/expect_used/expect_used.stderr b/src/tools/clippy/tests/ui-toml/expect_used/expect_used.stderr
new file mode 100644
index 000000000..9cb2199ed
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/expect_used/expect_used.stderr
@@ -0,0 +1,19 @@
+error: used `expect()` on `an Option` value
+ --> $DIR/expect_used.rs:6:13
+ |
+LL | let _ = opt.expect("");
+ | ^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::expect-used` implied by `-D warnings`
+ = help: if this value is an `None`, it will panic
+
+error: used `expect()` on `a Result` value
+ --> $DIR/expect_used.rs:11:13
+ |
+LL | let _ = res.expect("");
+ | ^^^^^^^^^^^^^^
+ |
+ = help: if this value is an `Err`, it will panic
+
+error: aborting due to 2 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/clippy.toml b/src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/clippy.toml
new file mode 100644
index 000000000..022eec3e0
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/clippy.toml
@@ -0,0 +1 @@
+max-fn-params-bools = 1
diff --git a/src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/test.rs b/src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/test.rs
new file mode 100644
index 000000000..42897b389
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/test.rs
@@ -0,0 +1,6 @@
+#![warn(clippy::fn_params_excessive_bools)]
+
+fn f(_: bool) {}
+fn g(_: bool, _: bool) {}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/test.stderr b/src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/test.stderr
new file mode 100644
index 000000000..d05adc3d3
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/test.stderr
@@ -0,0 +1,11 @@
+error: more than 1 bools in function parameters
+ --> $DIR/test.rs:4:1
+ |
+LL | fn g(_: bool, _: bool) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::fn-params-excessive-bools` implied by `-D warnings`
+ = help: consider refactoring bools into two-variant enums
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/functions_maxlines/clippy.toml b/src/tools/clippy/tests/ui-toml/functions_maxlines/clippy.toml
new file mode 100644
index 000000000..951dbb523
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/functions_maxlines/clippy.toml
@@ -0,0 +1 @@
+too-many-lines-threshold = 1
diff --git a/src/tools/clippy/tests/ui-toml/functions_maxlines/test.rs b/src/tools/clippy/tests/ui-toml/functions_maxlines/test.rs
new file mode 100644
index 000000000..4ac037854
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/functions_maxlines/test.rs
@@ -0,0 +1,60 @@
+#![warn(clippy::too_many_lines)]
+#![allow(clippy::let_unit_value)]
+
+// This function should be considered one line.
+fn many_comments_but_one_line_of_code() {
+ /* println!("This is good."); */
+ // println!("This is good.");
+ /* */ // println!("This is good.");
+ /* */ // println!("This is good.");
+ /* */ // println!("This is good.");
+ /* */ // println!("This is good.");
+ /* println!("This is good.");
+ println!("This is good.");
+ println!("This is good."); */
+ println!("This is good.");
+}
+
+// This should be considered two and a fail.
+fn too_many_lines() {
+ println!("This is bad.");
+ println!("This is bad.");
+}
+
+// This should only fail once (#7517).
+async fn async_too_many_lines() {
+ println!("This is bad.");
+ println!("This is bad.");
+}
+
+// This should fail only once, without failing on the closure.
+fn closure_too_many_lines() {
+ let _ = {
+ println!("This is bad.");
+ println!("This is bad.");
+ };
+}
+
+// This should be considered one line.
+#[rustfmt::skip]
+fn comment_starts_after_code() {
+ let _ = 5; /* closing comment. */ /*
+ this line shouldn't be counted theoretically.
+ */
+}
+
+// This should be considered one line.
+fn comment_after_code() {
+ let _ = 5; /* this line should get counted once. */
+}
+
+// This should fail since it is technically two lines.
+#[rustfmt::skip]
+fn comment_before_code() {
+ let _ = "test";
+ /* This comment extends to the front of
+ the code but this line should still count. */ let _ = 5;
+}
+
+// This should be considered one line.
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/functions_maxlines/test.stderr b/src/tools/clippy/tests/ui-toml/functions_maxlines/test.stderr
new file mode 100644
index 000000000..dc255bdca
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/functions_maxlines/test.stderr
@@ -0,0 +1,43 @@
+error: this function has too many lines (2/1)
+ --> $DIR/test.rs:19:1
+ |
+LL | / fn too_many_lines() {
+LL | | println!("This is bad.");
+LL | | println!("This is bad.");
+LL | | }
+ | |_^
+ |
+ = note: `-D clippy::too-many-lines` implied by `-D warnings`
+
+error: this function has too many lines (4/1)
+ --> $DIR/test.rs:25:1
+ |
+LL | / async fn async_too_many_lines() {
+LL | | println!("This is bad.");
+LL | | println!("This is bad.");
+LL | | }
+ | |_^
+
+error: this function has too many lines (4/1)
+ --> $DIR/test.rs:31:1
+ |
+LL | / fn closure_too_many_lines() {
+LL | | let _ = {
+LL | | println!("This is bad.");
+LL | | println!("This is bad.");
+LL | | };
+LL | | }
+ | |_^
+
+error: this function has too many lines (2/1)
+ --> $DIR/test.rs:53:1
+ |
+LL | / fn comment_before_code() {
+LL | | let _ = "test";
+LL | | /* This comment extends to the front of
+LL | | the code but this line should still count. */ let _ = 5;
+LL | | }
+ | |_^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/good_toml_no_false_negatives/clippy.toml b/src/tools/clippy/tests/ui-toml/good_toml_no_false_negatives/clippy.toml
new file mode 100644
index 000000000..a1dd6b2f0
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/good_toml_no_false_negatives/clippy.toml
@@ -0,0 +1,3 @@
+# that one is white-listed
+[third-party]
+clippy-feature = "nightly"
diff --git a/src/tools/clippy/tests/ui-toml/good_toml_no_false_negatives/conf_no_false_negatives.rs b/src/tools/clippy/tests/ui-toml/good_toml_no_false_negatives/conf_no_false_negatives.rs
new file mode 100644
index 000000000..f328e4d9d
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/good_toml_no_false_negatives/conf_no_false_negatives.rs
@@ -0,0 +1 @@
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/invalid_min_rust_version/clippy.toml b/src/tools/clippy/tests/ui-toml/invalid_min_rust_version/clippy.toml
new file mode 100644
index 000000000..088b12b2d
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/invalid_min_rust_version/clippy.toml
@@ -0,0 +1 @@
+msrv = "invalid.version"
diff --git a/src/tools/clippy/tests/ui-toml/invalid_min_rust_version/invalid_min_rust_version.rs b/src/tools/clippy/tests/ui-toml/invalid_min_rust_version/invalid_min_rust_version.rs
new file mode 100644
index 000000000..2ebf28645
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/invalid_min_rust_version/invalid_min_rust_version.rs
@@ -0,0 +1,3 @@
+#![allow(clippy::redundant_clone)]
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/invalid_min_rust_version/invalid_min_rust_version.stderr b/src/tools/clippy/tests/ui-toml/invalid_min_rust_version/invalid_min_rust_version.stderr
new file mode 100644
index 000000000..e9d8fd2e0
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/invalid_min_rust_version/invalid_min_rust_version.stderr
@@ -0,0 +1,4 @@
+error: error reading Clippy's configuration file. `invalid.version` is not a valid Rust version
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/large_include_file/clippy.toml b/src/tools/clippy/tests/ui-toml/large_include_file/clippy.toml
new file mode 100644
index 000000000..ea34bf9fb
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/large_include_file/clippy.toml
@@ -0,0 +1 @@
+max-include-file-size = 600
diff --git a/src/tools/clippy/tests/ui-toml/large_include_file/large_include_file.rs b/src/tools/clippy/tests/ui-toml/large_include_file/large_include_file.rs
new file mode 100644
index 000000000..f3dbb6ad1
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/large_include_file/large_include_file.rs
@@ -0,0 +1,16 @@
+#![warn(clippy::large_include_file)]
+
+// Good
+const GOOD_INCLUDE_BYTES: &[u8; 581] = include_bytes!("large_include_file.rs");
+const GOOD_INCLUDE_STR: &str = include_str!("large_include_file.rs");
+
+#[allow(clippy::large_include_file)]
+const ALLOWED_TOO_BIG_INCLUDE_BYTES: &[u8; 654] = include_bytes!("too_big.txt");
+#[allow(clippy::large_include_file)]
+const ALLOWED_TOO_BIG_INCLUDE_STR: &str = include_str!("too_big.txt");
+
+// Bad
+const TOO_BIG_INCLUDE_BYTES: &[u8; 654] = include_bytes!("too_big.txt");
+const TOO_BIG_INCLUDE_STR: &str = include_str!("too_big.txt");
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/large_include_file/large_include_file.stderr b/src/tools/clippy/tests/ui-toml/large_include_file/large_include_file.stderr
new file mode 100644
index 000000000..6a685a583
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/large_include_file/large_include_file.stderr
@@ -0,0 +1,21 @@
+error: attempted to include a large file
+ --> $DIR/large_include_file.rs:13:43
+ |
+LL | const TOO_BIG_INCLUDE_BYTES: &[u8; 654] = include_bytes!("too_big.txt");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::large-include-file` implied by `-D warnings`
+ = note: the configuration allows a maximum size of 600 bytes
+ = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: attempted to include a large file
+ --> $DIR/large_include_file.rs:14:35
+ |
+LL | const TOO_BIG_INCLUDE_STR: &str = include_str!("too_big.txt");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the configuration allows a maximum size of 600 bytes
+ = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/large_include_file/too_big.txt b/src/tools/clippy/tests/ui-toml/large_include_file/too_big.txt
new file mode 100644
index 000000000..9829c46bc
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/large_include_file/too_big.txt
@@ -0,0 +1 @@
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Maecenas accumsan lacus vel facilisis volutpat. Etiam dignissim diam quis enim lobortis scelerisque fermentum dui faucibus. Tellus id interdum velit laoreet id donec ultrices. Est ultricies integer quis auctor elit sed vulputate. Erat velit scelerisque in dictum non consectetur a erat nam. Sed blandit libero volutpat sed. Tortor condimentum lacinia quis vel eros. Enim ut tellus elementum sagittis vitae et leo duis. Congue mauris rhoncus aenean vel elit scelerisque. Id consectetur purus ut faucibus pulvinar elementum integer. \ No newline at end of file
diff --git a/src/tools/clippy/tests/ui-toml/lint_decimal_readability/clippy.toml b/src/tools/clippy/tests/ui-toml/lint_decimal_readability/clippy.toml
new file mode 100644
index 000000000..6feaf7d5c
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/lint_decimal_readability/clippy.toml
@@ -0,0 +1 @@
+unreadable-literal-lint-fractions = false \ No newline at end of file
diff --git a/src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.rs b/src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.rs
new file mode 100644
index 000000000..2498672d7
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.rs
@@ -0,0 +1,23 @@
+#![allow(clippy::excessive_precision)]
+#[deny(clippy::unreadable_literal)]
+
+fn allow_inconsistent_digit_grouping() {
+ #![allow(clippy::inconsistent_digit_grouping)]
+ let _pass1 = 100_200_300.123456789;
+}
+
+fn main() {
+ allow_inconsistent_digit_grouping();
+
+ let _pass1 = 100_200_300.100_200_300;
+ let _pass2 = 1.123456789;
+ let _pass3 = 1.0;
+ let _pass4 = 10000.00001;
+ let _pass5 = 1.123456789e1;
+
+ // due to clippy::inconsistent-digit-grouping
+ let _fail1 = 100_200_300.123456789;
+
+ // fail due to the integer part
+ let _fail2 = 100200300.300200100;
+}
diff --git a/src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.stderr b/src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.stderr
new file mode 100644
index 000000000..be505bda4
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.stderr
@@ -0,0 +1,10 @@
+error: digits grouped inconsistently by underscores
+ --> $DIR/test.rs:19:18
+ |
+LL | let _fail1 = 100_200_300.123456789;
+ | ^^^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.123_456_789`
+ |
+ = note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings`
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/max_suggested_slice_pattern_length/clippy.toml b/src/tools/clippy/tests/ui-toml/max_suggested_slice_pattern_length/clippy.toml
new file mode 100644
index 000000000..78c7e63b4
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/max_suggested_slice_pattern_length/clippy.toml
@@ -0,0 +1 @@
+max-suggested-slice-pattern-length = 8
diff --git a/src/tools/clippy/tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs b/src/tools/clippy/tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs
new file mode 100644
index 000000000..21849a14f
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs
@@ -0,0 +1,23 @@
+#![deny(clippy::index_refutable_slice)]
+
+fn below_limit() {
+ let slice: Option<&[u32]> = Some(&[1, 2, 3]);
+ if let Some(slice) = slice {
+ // This would usually not be linted but is included now due to the
+ // index limit in the config file
+ println!("{}", slice[7]);
+ }
+}
+
+fn above_limit() {
+ let slice: Option<&[u32]> = Some(&[1, 2, 3]);
+ if let Some(slice) = slice {
+ // This will not be linted as 8 is above the limit
+ println!("{}", slice[8]);
+ }
+}
+
+fn main() {
+ below_limit();
+ above_limit();
+}
diff --git a/src/tools/clippy/tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.stderr b/src/tools/clippy/tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.stderr
new file mode 100644
index 000000000..d319e65d0
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.stderr
@@ -0,0 +1,22 @@
+error: this binding can be a slice pattern to avoid indexing
+ --> $DIR/index_refutable_slice.rs:5:17
+ |
+LL | if let Some(slice) = slice {
+ | ^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/index_refutable_slice.rs:1:9
+ |
+LL | #![deny(clippy::index_refutable_slice)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: try using a slice pattern here
+ |
+LL | if let Some([_, _, _, _, _, _, _, slice_7, ..]) = slice {
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+help: and replace the index expressions here
+ |
+LL | println!("{}", slice_7);
+ | ~~~~~~~
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/min_rust_version/clippy.toml b/src/tools/clippy/tests/ui-toml/min_rust_version/clippy.toml
new file mode 100644
index 000000000..8e17d8074
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/min_rust_version/clippy.toml
@@ -0,0 +1 @@
+msrv = "1.0.0"
diff --git a/src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.rs b/src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.rs
new file mode 100644
index 000000000..1e3ec123a
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.rs
@@ -0,0 +1,98 @@
+#![allow(clippy::redundant_clone, clippy::unnecessary_operation)]
+#![warn(clippy::manual_non_exhaustive, clippy::borrow_as_ptr, clippy::manual_bits)]
+
+use std::mem::{size_of, size_of_val};
+use std::ops::Deref;
+
+mod enums {
+ enum E {
+ A,
+ B,
+ #[doc(hidden)]
+ _C,
+ }
+
+ // user forgot to remove the marker
+ #[non_exhaustive]
+ enum Ep {
+ A,
+ B,
+ #[doc(hidden)]
+ _C,
+ }
+}
+
+fn option_as_ref_deref() {
+ let mut opt = Some(String::from("123"));
+
+ let _ = opt.as_ref().map(String::as_str);
+ let _ = opt.as_ref().map(|x| x.as_str());
+ let _ = opt.as_mut().map(String::as_mut_str);
+ let _ = opt.as_mut().map(|x| x.as_mut_str());
+}
+
+fn match_like_matches() {
+ let _y = match Some(5) {
+ Some(0) => true,
+ _ => false,
+ };
+}
+
+fn match_same_arms() {
+ match (1, 2, 3) {
+ (1, .., 3) => 42,
+ (.., 3) => 42, //~ ERROR match arms have same body
+ _ => 0,
+ };
+}
+
+fn match_same_arms2() {
+ let _ = match Some(42) {
+ Some(_) => 24,
+ None => 24, //~ ERROR match arms have same body
+ };
+}
+
+fn manual_strip_msrv() {
+ let s = "hello, world!";
+ if s.starts_with("hello, ") {
+ assert_eq!(s["hello, ".len()..].to_uppercase(), "WORLD!");
+ }
+}
+
+fn check_index_refutable_slice() {
+ // This shouldn't trigger `clippy::index_refutable_slice` as the suggestion
+ // would only be valid from 1.42.0 onward
+ let slice: Option<&[u32]> = Some(&[1]);
+ if let Some(slice) = slice {
+ println!("{}", slice[0]);
+ }
+}
+
+fn map_clone_suggest_copied() {
+ // This should still trigger the lint but suggest `cloned()` instead of `copied()`
+ let _: Option<u64> = Some(&16).map(|b| *b);
+}
+
+fn borrow_as_ptr() {
+ let val = 1;
+ let _p = &val as *const i32;
+
+ let mut val_mut = 1;
+ let _p_mut = &mut val_mut as *mut i32;
+}
+
+fn manual_bits() {
+ size_of::<i8>() * 8;
+ size_of_val(&0u32) * 8;
+}
+
+fn main() {
+ option_as_ref_deref();
+ match_like_matches();
+ match_same_arms();
+ match_same_arms2();
+ manual_strip_msrv();
+ check_index_refutable_slice();
+ borrow_as_ptr();
+}
diff --git a/src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.stderr b/src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.stderr
new file mode 100644
index 000000000..5dae5af7e
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.stderr
@@ -0,0 +1,10 @@
+error: you are using an explicit closure for cloning elements
+ --> $DIR/min_rust_version.rs:74:26
+ |
+LL | let _: Option<u64> = Some(&16).map(|b| *b);
+ | ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `Some(&16).cloned()`
+ |
+ = note: `-D clippy::map-clone` implied by `-D warnings`
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/clippy.toml b/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/clippy.toml
new file mode 100644
index 000000000..05ba82287
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/clippy.toml
@@ -0,0 +1,10 @@
+enforced-import-renames = [
+ { path = "std::option::Option", rename = "Maybe" },
+ { path = "std::process::Child", rename = "Kid" },
+ { path = "std::process::exit", rename = "goodbye" },
+ { path = "std::collections::BTreeMap", rename = "Map" },
+ { path = "std::clone", rename = "foo" },
+ { path = "std::thread::sleep", rename = "thread_sleep" },
+ { path = "std::any::type_name", rename = "ident" },
+ { path = "std::sync::Mutex", rename = "StdMutie" }
+]
diff --git a/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs b/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs
new file mode 100644
index 000000000..f60058c86
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs
@@ -0,0 +1,16 @@
+#![warn(clippy::missing_enforced_import_renames)]
+
+use std::alloc as colla;
+use std::option::Option as Maybe;
+use std::process::{exit as wrong_exit, Child as Kid};
+use std::thread::sleep;
+#[rustfmt::skip]
+use std::{
+ any::{type_name, Any},
+ clone,
+ sync :: Mutex,
+};
+
+fn main() {
+ use std::collections::BTreeMap as OopsWrongRename;
+}
diff --git a/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.stderr b/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.stderr
new file mode 100644
index 000000000..45de8fdff
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.stderr
@@ -0,0 +1,40 @@
+error: this import should be renamed
+ --> $DIR/conf_missing_enforced_import_rename.rs:5:20
+ |
+LL | use std::process::{exit as wrong_exit, Child as Kid};
+ | ^^^^^^^^^^^^^^^^^^ help: try: `exit as goodbye`
+ |
+ = note: `-D clippy::missing-enforced-import-renames` implied by `-D warnings`
+
+error: this import should be renamed
+ --> $DIR/conf_missing_enforced_import_rename.rs:6:1
+ |
+LL | use std::thread::sleep;
+ | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `use std::thread::sleep as thread_sleep`
+
+error: this import should be renamed
+ --> $DIR/conf_missing_enforced_import_rename.rs:9:11
+ |
+LL | any::{type_name, Any},
+ | ^^^^^^^^^ help: try: `type_name as ident`
+
+error: this import should be renamed
+ --> $DIR/conf_missing_enforced_import_rename.rs:10:5
+ |
+LL | clone,
+ | ^^^^^ help: try: `clone as foo`
+
+error: this import should be renamed
+ --> $DIR/conf_missing_enforced_import_rename.rs:11:5
+ |
+LL | sync :: Mutex,
+ | ^^^^^^^^^^^^^ help: try: `sync :: Mutex as StdMutie`
+
+error: this import should be renamed
+ --> $DIR/conf_missing_enforced_import_rename.rs:15:5
+ |
+LL | use std::collections::BTreeMap as OopsWrongRename;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `use std::collections::BTreeMap as Map`
+
+error: aborting due to 6 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/auxiliary/proc_macro_derive.rs b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/auxiliary/proc_macro_derive.rs
new file mode 100644
index 000000000..6452189a4
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/auxiliary/proc_macro_derive.rs
@@ -0,0 +1,18 @@
+// compile-flags: --emit=link
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(DeriveSomething)]
+pub fn derive(_: TokenStream) -> TokenStream {
+ "fn _f() -> Vec<u8> { vec![] }".parse().unwrap()
+}
+
+#[proc_macro]
+pub fn foo_bar(_: TokenStream) -> TokenStream {
+ "fn issue_7422() { eprintln!(); }".parse().unwrap()
+}
diff --git a/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/clippy.toml b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/clippy.toml
new file mode 100644
index 000000000..bced8948a
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/clippy.toml
@@ -0,0 +1,6 @@
+standard-macro-braces = [
+ { name = "quote", brace = "{" },
+ { name = "quote::quote", brace = "{" },
+ { name = "eprint", brace = "[" },
+ { name = "type_pos", brace = "[" },
+]
diff --git a/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs
new file mode 100644
index 000000000..5b4adc868
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs
@@ -0,0 +1,60 @@
+// aux-build:proc_macro_derive.rs
+
+#![warn(clippy::nonstandard_macro_braces)]
+
+extern crate proc_macro_derive;
+extern crate quote;
+
+use quote::quote;
+
+#[derive(proc_macro_derive::DeriveSomething)]
+pub struct S;
+
+proc_macro_derive::foo_bar!();
+
+#[rustfmt::skip]
+macro_rules! test {
+ () => {
+ vec!{0, 0, 0}
+ };
+}
+
+#[rustfmt::skip]
+macro_rules! test2 {
+ ($($arg:tt)*) => {
+ format_args!($($arg)*)
+ };
+}
+
+macro_rules! type_pos {
+ ($what:ty) => {
+ Vec<$what>
+ };
+}
+
+macro_rules! printlnfoo {
+ ($thing:expr) => {
+ println!("{}", $thing)
+ };
+}
+
+#[rustfmt::skip]
+fn main() {
+ let _ = vec! {1, 2, 3};
+ let _ = format!["ugh {} stop being such a good compiler", "hello"];
+ let _ = quote!(let x = 1;);
+ let _ = quote::quote!(match match match);
+ let _ = test!(); // trigger when macro def is inside our own crate
+ let _ = vec![1,2,3];
+
+ let _ = quote::quote! {true || false};
+ let _ = vec! [0 ,0 ,0];
+ let _ = format!("fds{}fds", 10);
+ let _ = test2!["{}{}{}", 1, 2, 3];
+
+ let _: type_pos!(usize) = vec![];
+
+ eprint!("test if user config overrides defaults");
+
+ printlnfoo!["test if printlnfoo is triggered by println"];
+}
diff --git a/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.stderr b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.stderr
new file mode 100644
index 000000000..039b23b1b
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.stderr
@@ -0,0 +1,94 @@
+error: use of irregular braces for `vec!` macro
+ --> $DIR/conf_nonstandard_macro_braces.rs:43:13
+ |
+LL | let _ = vec! {1, 2, 3};
+ | ^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings`
+help: consider writing `vec![1, 2, 3]`
+ --> $DIR/conf_nonstandard_macro_braces.rs:43:13
+ |
+LL | let _ = vec! {1, 2, 3};
+ | ^^^^^^^^^^^^^^
+
+error: use of irregular braces for `format!` macro
+ --> $DIR/conf_nonstandard_macro_braces.rs:44:13
+ |
+LL | let _ = format!["ugh {} stop being such a good compiler", "hello"];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: consider writing `format!("ugh () stop being such a good compiler", "hello")`
+ --> $DIR/conf_nonstandard_macro_braces.rs:44:13
+ |
+LL | let _ = format!["ugh {} stop being such a good compiler", "hello"];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of irregular braces for `quote!` macro
+ --> $DIR/conf_nonstandard_macro_braces.rs:45:13
+ |
+LL | let _ = quote!(let x = 1;);
+ | ^^^^^^^^^^^^^^^^^^
+ |
+help: consider writing `quote! {let x = 1;}`
+ --> $DIR/conf_nonstandard_macro_braces.rs:45:13
+ |
+LL | let _ = quote!(let x = 1;);
+ | ^^^^^^^^^^^^^^^^^^
+
+error: use of irregular braces for `quote::quote!` macro
+ --> $DIR/conf_nonstandard_macro_braces.rs:46:13
+ |
+LL | let _ = quote::quote!(match match match);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: consider writing `quote::quote! {match match match}`
+ --> $DIR/conf_nonstandard_macro_braces.rs:46:13
+ |
+LL | let _ = quote::quote!(match match match);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of irregular braces for `vec!` macro
+ --> $DIR/conf_nonstandard_macro_braces.rs:18:9
+ |
+LL | vec!{0, 0, 0}
+ | ^^^^^^^^^^^^^
+...
+LL | let _ = test!(); // trigger when macro def is inside our own crate
+ | ------- in this macro invocation
+ |
+help: consider writing `vec![0, 0, 0]`
+ --> $DIR/conf_nonstandard_macro_braces.rs:18:9
+ |
+LL | vec!{0, 0, 0}
+ | ^^^^^^^^^^^^^
+...
+LL | let _ = test!(); // trigger when macro def is inside our own crate
+ | ------- in this macro invocation
+ = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: use of irregular braces for `type_pos!` macro
+ --> $DIR/conf_nonstandard_macro_braces.rs:55:12
+ |
+LL | let _: type_pos!(usize) = vec![];
+ | ^^^^^^^^^^^^^^^^
+ |
+help: consider writing `type_pos![usize]`
+ --> $DIR/conf_nonstandard_macro_braces.rs:55:12
+ |
+LL | let _: type_pos!(usize) = vec![];
+ | ^^^^^^^^^^^^^^^^
+
+error: use of irregular braces for `eprint!` macro
+ --> $DIR/conf_nonstandard_macro_braces.rs:57:5
+ |
+LL | eprint!("test if user config overrides defaults");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: consider writing `eprint!["test if user config overrides defaults"]`
+ --> $DIR/conf_nonstandard_macro_braces.rs:57:5
+ |
+LL | eprint!("test if user config overrides defaults");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 7 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/clippy.toml b/src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/clippy.toml
new file mode 100644
index 000000000..a942709d1
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/clippy.toml
@@ -0,0 +1 @@
+enable-raw-pointer-heuristic-for-send = false
diff --git a/src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/test.rs b/src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/test.rs
new file mode 100644
index 000000000..90c2439dc
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/test.rs
@@ -0,0 +1,43 @@
+#![warn(clippy::non_send_fields_in_send_ty)]
+#![feature(extern_types)]
+
+use std::rc::Rc;
+
+// Basic tests should not be affected
+pub struct NoGeneric {
+ rc_is_not_send: Rc<String>,
+}
+
+unsafe impl Send for NoGeneric {}
+
+pub struct MultiField<T> {
+ field1: T,
+ field2: T,
+ field3: T,
+}
+
+unsafe impl<T> Send for MultiField<T> {}
+
+pub enum MyOption<T> {
+ MySome(T),
+ MyNone,
+}
+
+unsafe impl<T> Send for MyOption<T> {}
+
+// All fields are disallowed when raw pointer heuristic is off
+extern "C" {
+ type NonSend;
+}
+
+pub struct HeuristicTest {
+ field1: Vec<*const NonSend>,
+ field2: [*const NonSend; 3],
+ field3: (*const NonSend, *const NonSend, *const NonSend),
+ field4: (*const NonSend, Rc<u8>),
+ field5: Vec<Vec<*const NonSend>>,
+}
+
+unsafe impl Send for HeuristicTest {}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/test.stderr b/src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/test.stderr
new file mode 100644
index 000000000..49eecf18b
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/test.stderr
@@ -0,0 +1,91 @@
+error: some fields in `NoGeneric` are not safe to be sent to another thread
+ --> $DIR/test.rs:11:1
+ |
+LL | unsafe impl Send for NoGeneric {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::non-send-fields-in-send-ty` implied by `-D warnings`
+note: it is not safe to send field `rc_is_not_send` to another thread
+ --> $DIR/test.rs:8:5
+ |
+LL | rc_is_not_send: Rc<String>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: use a thread-safe type that implements `Send`
+
+error: some fields in `MultiField<T>` are not safe to be sent to another thread
+ --> $DIR/test.rs:19:1
+ |
+LL | unsafe impl<T> Send for MultiField<T> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: it is not safe to send field `field1` to another thread
+ --> $DIR/test.rs:14:5
+ |
+LL | field1: T,
+ | ^^^^^^^^^
+ = help: add `T: Send` bound in `Send` impl
+note: it is not safe to send field `field2` to another thread
+ --> $DIR/test.rs:15:5
+ |
+LL | field2: T,
+ | ^^^^^^^^^
+ = help: add `T: Send` bound in `Send` impl
+note: it is not safe to send field `field3` to another thread
+ --> $DIR/test.rs:16:5
+ |
+LL | field3: T,
+ | ^^^^^^^^^
+ = help: add `T: Send` bound in `Send` impl
+
+error: some fields in `MyOption<T>` are not safe to be sent to another thread
+ --> $DIR/test.rs:26:1
+ |
+LL | unsafe impl<T> Send for MyOption<T> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: it is not safe to send field `0` to another thread
+ --> $DIR/test.rs:22:12
+ |
+LL | MySome(T),
+ | ^
+ = help: add `T: Send` bound in `Send` impl
+
+error: some fields in `HeuristicTest` are not safe to be sent to another thread
+ --> $DIR/test.rs:41:1
+ |
+LL | unsafe impl Send for HeuristicTest {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: it is not safe to send field `field1` to another thread
+ --> $DIR/test.rs:34:5
+ |
+LL | field1: Vec<*const NonSend>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: use a thread-safe type that implements `Send`
+note: it is not safe to send field `field2` to another thread
+ --> $DIR/test.rs:35:5
+ |
+LL | field2: [*const NonSend; 3],
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: use a thread-safe type that implements `Send`
+note: it is not safe to send field `field3` to another thread
+ --> $DIR/test.rs:36:5
+ |
+LL | field3: (*const NonSend, *const NonSend, *const NonSend),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: use a thread-safe type that implements `Send`
+note: it is not safe to send field `field4` to another thread
+ --> $DIR/test.rs:37:5
+ |
+LL | field4: (*const NonSend, Rc<u8>),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: use a thread-safe type that implements `Send`
+note: it is not safe to send field `field5` to another thread
+ --> $DIR/test.rs:38:5
+ |
+LL | field5: Vec<Vec<*const NonSend>>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: use a thread-safe type that implements `Send`
+
+error: aborting due to 4 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/struct_excessive_bools/clippy.toml b/src/tools/clippy/tests/ui-toml/struct_excessive_bools/clippy.toml
new file mode 100644
index 000000000..3912ab542
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/struct_excessive_bools/clippy.toml
@@ -0,0 +1 @@
+max-struct-bools = 0
diff --git a/src/tools/clippy/tests/ui-toml/struct_excessive_bools/test.rs b/src/tools/clippy/tests/ui-toml/struct_excessive_bools/test.rs
new file mode 100644
index 000000000..32dd80246
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/struct_excessive_bools/test.rs
@@ -0,0 +1,9 @@
+#![warn(clippy::struct_excessive_bools)]
+
+struct S {
+ a: bool,
+}
+
+struct Foo;
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/struct_excessive_bools/test.stderr b/src/tools/clippy/tests/ui-toml/struct_excessive_bools/test.stderr
new file mode 100644
index 000000000..65861d10d
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/struct_excessive_bools/test.stderr
@@ -0,0 +1,13 @@
+error: more than 0 bools in a struct
+ --> $DIR/test.rs:3:1
+ |
+LL | / struct S {
+LL | | a: bool,
+LL | | }
+ | |_^
+ |
+ = note: `-D clippy::struct-excessive-bools` implied by `-D warnings`
+ = help: consider using a state machine or refactoring bools into two-variant enums
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/toml_blacklist/clippy.toml b/src/tools/clippy/tests/ui-toml/toml_blacklist/clippy.toml
new file mode 100644
index 000000000..6abe5a3bb
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_blacklist/clippy.toml
@@ -0,0 +1 @@
+blacklisted-names = ["toto", "tata", "titi"]
diff --git a/src/tools/clippy/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.rs b/src/tools/clippy/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.rs
new file mode 100644
index 000000000..cb35d0e85
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.rs
@@ -0,0 +1,20 @@
+#![allow(dead_code)]
+#![allow(clippy::single_match)]
+#![allow(unused_variables)]
+#![warn(clippy::blacklisted_name)]
+
+fn test(toto: ()) {}
+
+fn main() {
+ let toto = 42;
+ let tata = 42;
+ let titi = 42;
+
+ let tatab = 42;
+ let tatatataic = 42;
+
+ match (42, Some(1337), Some(0)) {
+ (toto, Some(tata), titi @ Some(_)) => (),
+ _ => (),
+ }
+}
diff --git a/src/tools/clippy/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.stderr b/src/tools/clippy/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.stderr
new file mode 100644
index 000000000..84ba77851
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.stderr
@@ -0,0 +1,46 @@
+error: use of a blacklisted/placeholder name `toto`
+ --> $DIR/conf_french_blacklisted_name.rs:6:9
+ |
+LL | fn test(toto: ()) {}
+ | ^^^^
+ |
+ = note: `-D clippy::blacklisted-name` implied by `-D warnings`
+
+error: use of a blacklisted/placeholder name `toto`
+ --> $DIR/conf_french_blacklisted_name.rs:9:9
+ |
+LL | let toto = 42;
+ | ^^^^
+
+error: use of a blacklisted/placeholder name `tata`
+ --> $DIR/conf_french_blacklisted_name.rs:10:9
+ |
+LL | let tata = 42;
+ | ^^^^
+
+error: use of a blacklisted/placeholder name `titi`
+ --> $DIR/conf_french_blacklisted_name.rs:11:9
+ |
+LL | let titi = 42;
+ | ^^^^
+
+error: use of a blacklisted/placeholder name `toto`
+ --> $DIR/conf_french_blacklisted_name.rs:17:10
+ |
+LL | (toto, Some(tata), titi @ Some(_)) => (),
+ | ^^^^
+
+error: use of a blacklisted/placeholder name `tata`
+ --> $DIR/conf_french_blacklisted_name.rs:17:21
+ |
+LL | (toto, Some(tata), titi @ Some(_)) => (),
+ | ^^^^
+
+error: use of a blacklisted/placeholder name `titi`
+ --> $DIR/conf_french_blacklisted_name.rs:17:28
+ |
+LL | (toto, Some(tata), titi @ Some(_)) => (),
+ | ^^^^
+
+error: aborting due to 7 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/toml_disallowed_methods/clippy.toml b/src/tools/clippy/tests/ui-toml/toml_disallowed_methods/clippy.toml
new file mode 100644
index 000000000..c902d2112
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_disallowed_methods/clippy.toml
@@ -0,0 +1,10 @@
+disallowed-methods = [
+ # just a string is shorthand for path only
+ "std::iter::Iterator::sum",
+ "f32::clamp",
+ "slice::sort_unstable",
+ # can give path and reason with an inline table
+ { path = "regex::Regex::is_match", reason = "no matching allowed" },
+ # can use an inline table but omit reason
+ { path = "regex::Regex::new" },
+]
diff --git a/src/tools/clippy/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs b/src/tools/clippy/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs
new file mode 100644
index 000000000..3397fa1ec
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs
@@ -0,0 +1,23 @@
+#![warn(clippy::disallowed_methods)]
+
+extern crate regex;
+use regex::Regex;
+
+fn main() {
+ let re = Regex::new(r"ab.*c").unwrap();
+ re.is_match("abc");
+
+ let mut a = vec![1, 2, 3, 4];
+ a.iter().sum::<i32>();
+
+ a.sort_unstable();
+
+ let _ = 2.0f32.clamp(3.0f32, 4.0f32);
+ let _ = 2.0f64.clamp(3.0f64, 4.0f64);
+
+ let indirect: fn(&str) -> Result<Regex, regex::Error> = Regex::new;
+ let re = indirect(".").unwrap();
+
+ let in_call = Box::new(f32::clamp);
+ let in_method_call = ["^", "$"].into_iter().map(Regex::new);
+}
diff --git a/src/tools/clippy/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.stderr b/src/tools/clippy/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.stderr
new file mode 100644
index 000000000..5cbb56754
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.stderr
@@ -0,0 +1,54 @@
+error: use of a disallowed method `regex::Regex::new`
+ --> $DIR/conf_disallowed_methods.rs:7:14
+ |
+LL | let re = Regex::new(r"ab.*c").unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::disallowed-methods` implied by `-D warnings`
+
+error: use of a disallowed method `regex::Regex::is_match`
+ --> $DIR/conf_disallowed_methods.rs:8:5
+ |
+LL | re.is_match("abc");
+ | ^^^^^^^^^^^^^^^^^^
+ |
+ = note: no matching allowed (from clippy.toml)
+
+error: use of a disallowed method `std::iter::Iterator::sum`
+ --> $DIR/conf_disallowed_methods.rs:11:5
+ |
+LL | a.iter().sum::<i32>();
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: use of a disallowed method `slice::sort_unstable`
+ --> $DIR/conf_disallowed_methods.rs:13:5
+ |
+LL | a.sort_unstable();
+ | ^^^^^^^^^^^^^^^^^
+
+error: use of a disallowed method `f32::clamp`
+ --> $DIR/conf_disallowed_methods.rs:15:13
+ |
+LL | let _ = 2.0f32.clamp(3.0f32, 4.0f32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of a disallowed method `regex::Regex::new`
+ --> $DIR/conf_disallowed_methods.rs:18:61
+ |
+LL | let indirect: fn(&str) -> Result<Regex, regex::Error> = Regex::new;
+ | ^^^^^^^^^^
+
+error: use of a disallowed method `f32::clamp`
+ --> $DIR/conf_disallowed_methods.rs:21:28
+ |
+LL | let in_call = Box::new(f32::clamp);
+ | ^^^^^^^^^^
+
+error: use of a disallowed method `regex::Regex::new`
+ --> $DIR/conf_disallowed_methods.rs:22:53
+ |
+LL | let in_method_call = ["^", "$"].into_iter().map(Regex::new);
+ | ^^^^^^^^^^
+
+error: aborting due to 8 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/toml_disallowed_types/clippy.toml b/src/tools/clippy/tests/ui-toml/toml_disallowed_types/clippy.toml
new file mode 100644
index 000000000..6cb9e2ef9
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_disallowed_types/clippy.toml
@@ -0,0 +1,15 @@
+disallowed-types = [
+ "std::collections::HashMap",
+ "std::sync::atomic::AtomicU32",
+ "syn::TypePath",
+ "proc_macro2::Ident",
+ "std::thread::Thread",
+ "std::time::Instant",
+ "std::io::Read",
+ "std::primitive::usize",
+ "bool",
+ # can give path and reason with an inline table
+ { path = "std::net::Ipv4Addr", reason = "no IPv4 allowed" },
+ # can use an inline table but omit reason
+ { path = "std::net::TcpListener" },
+]
diff --git a/src/tools/clippy/tests/ui-toml/toml_disallowed_types/conf_disallowed_types.rs b/src/tools/clippy/tests/ui-toml/toml_disallowed_types/conf_disallowed_types.rs
new file mode 100644
index 000000000..7f28efd67
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_disallowed_types/conf_disallowed_types.rs
@@ -0,0 +1,42 @@
+#![warn(clippy::disallowed_types)]
+
+extern crate quote;
+extern crate syn;
+
+use std::sync as foo;
+use std::sync::atomic::AtomicU32;
+use std::time::Instant as Sneaky;
+
+struct HashMap;
+
+fn bad_return_type() -> fn() -> Sneaky {
+ todo!()
+}
+
+fn bad_arg_type(_: impl Fn(Sneaky) -> foo::atomic::AtomicU32) {}
+
+fn trait_obj(_: &dyn std::io::Read) {}
+
+fn full_and_single_path_prim(_: usize, _: bool) {}
+
+fn const_generics<const C: usize>() {}
+
+struct GenArg<const U: usize>([u8; U]);
+
+static BAD: foo::atomic::AtomicPtr<()> = foo::atomic::AtomicPtr::new(std::ptr::null_mut());
+
+fn ip(_: std::net::Ipv4Addr) {}
+
+fn listener(_: std::net::TcpListener) {}
+
+#[allow(clippy::diverging_sub_expression)]
+fn main() {
+ let _: std::collections::HashMap<(), ()> = std::collections::HashMap::new();
+ let _ = Sneaky::now();
+ let _ = foo::atomic::AtomicU32::new(0);
+ static FOO: std::sync::atomic::AtomicU32 = foo::atomic::AtomicU32::new(1);
+ let _: std::collections::BTreeMap<(), syn::TypePath> = Default::default();
+ let _ = syn::Ident::new("", todo!());
+ let _ = HashMap;
+ let _: usize = 64_usize;
+}
diff --git a/src/tools/clippy/tests/ui-toml/toml_disallowed_types/conf_disallowed_types.stderr b/src/tools/clippy/tests/ui-toml/toml_disallowed_types/conf_disallowed_types.stderr
new file mode 100644
index 000000000..e3ece799c
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_disallowed_types/conf_disallowed_types.stderr
@@ -0,0 +1,132 @@
+error: `std::sync::atomic::AtomicU32` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:7:1
+ |
+LL | use std::sync::atomic::AtomicU32;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::disallowed-types` implied by `-D warnings`
+
+error: `std::time::Instant` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:8:1
+ |
+LL | use std::time::Instant as Sneaky;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `std::time::Instant` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:12:33
+ |
+LL | fn bad_return_type() -> fn() -> Sneaky {
+ | ^^^^^^
+
+error: `std::time::Instant` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:16:28
+ |
+LL | fn bad_arg_type(_: impl Fn(Sneaky) -> foo::atomic::AtomicU32) {}
+ | ^^^^^^
+
+error: `std::sync::atomic::AtomicU32` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:16:39
+ |
+LL | fn bad_arg_type(_: impl Fn(Sneaky) -> foo::atomic::AtomicU32) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: `std::io::Read` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:18:22
+ |
+LL | fn trait_obj(_: &dyn std::io::Read) {}
+ | ^^^^^^^^^^^^^
+
+error: `usize` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:20:33
+ |
+LL | fn full_and_single_path_prim(_: usize, _: bool) {}
+ | ^^^^^
+
+error: `bool` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:20:43
+ |
+LL | fn full_and_single_path_prim(_: usize, _: bool) {}
+ | ^^^^
+
+error: `usize` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:22:28
+ |
+LL | fn const_generics<const C: usize>() {}
+ | ^^^^^
+
+error: `usize` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:24:24
+ |
+LL | struct GenArg<const U: usize>([u8; U]);
+ | ^^^^^
+
+error: `std::net::Ipv4Addr` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:28:10
+ |
+LL | fn ip(_: std::net::Ipv4Addr) {}
+ | ^^^^^^^^^^^^^^^^^^
+ |
+ = note: no IPv4 allowed (from clippy.toml)
+
+error: `std::net::TcpListener` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:30:16
+ |
+LL | fn listener(_: std::net::TcpListener) {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: `std::collections::HashMap` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:34:48
+ |
+LL | let _: std::collections::HashMap<(), ()> = std::collections::HashMap::new();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `std::collections::HashMap` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:34:12
+ |
+LL | let _: std::collections::HashMap<(), ()> = std::collections::HashMap::new();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `std::time::Instant` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:35:13
+ |
+LL | let _ = Sneaky::now();
+ | ^^^^^^
+
+error: `std::sync::atomic::AtomicU32` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:36:13
+ |
+LL | let _ = foo::atomic::AtomicU32::new(0);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: `std::sync::atomic::AtomicU32` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:37:17
+ |
+LL | static FOO: std::sync::atomic::AtomicU32 = foo::atomic::AtomicU32::new(1);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `std::sync::atomic::AtomicU32` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:37:48
+ |
+LL | static FOO: std::sync::atomic::AtomicU32 = foo::atomic::AtomicU32::new(1);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: `syn::TypePath` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:38:43
+ |
+LL | let _: std::collections::BTreeMap<(), syn::TypePath> = Default::default();
+ | ^^^^^^^^^^^^^
+
+error: `syn::Ident` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:39:13
+ |
+LL | let _ = syn::Ident::new("", todo!());
+ | ^^^^^^^^^^
+
+error: `usize` is not allowed according to config
+ --> $DIR/conf_disallowed_types.rs:41:12
+ |
+LL | let _: usize = 64_usize;
+ | ^^^^^
+
+error: aborting due to 21 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/toml_trivially_copy/clippy.toml b/src/tools/clippy/tests/ui-toml/toml_trivially_copy/clippy.toml
new file mode 100644
index 000000000..3b96f1fd0
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_trivially_copy/clippy.toml
@@ -0,0 +1 @@
+trivial-copy-size-limit = 2
diff --git a/src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.rs b/src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.rs
new file mode 100644
index 000000000..fb0e226f3
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.rs
@@ -0,0 +1,20 @@
+// normalize-stderr-test "\(\d+ byte\)" -> "(N byte)"
+// normalize-stderr-test "\(limit: \d+ byte\)" -> "(limit: N byte)"
+
+#![deny(clippy::trivially_copy_pass_by_ref)]
+
+#[derive(Copy, Clone)]
+struct Foo(u8);
+
+#[derive(Copy, Clone)]
+struct Bar(u32);
+
+fn good(a: &mut u32, b: u32, c: &Bar, d: &u32) {}
+
+fn bad(x: &u16, y: &Foo) {}
+
+fn main() {
+ let (mut a, b, c, d, x, y) = (0, 0, Bar(0), 0, 0, Foo(0));
+ good(&mut a, b, &c, &d);
+ bad(&x, &y);
+}
diff --git a/src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.stderr b/src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.stderr
new file mode 100644
index 000000000..b3ef5928e
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.stderr
@@ -0,0 +1,20 @@
+error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
+ --> $DIR/test.rs:14:11
+ |
+LL | fn bad(x: &u16, y: &Foo) {}
+ | ^^^^ help: consider passing by value instead: `u16`
+ |
+note: the lint level is defined here
+ --> $DIR/test.rs:4:9
+ |
+LL | #![deny(clippy::trivially_copy_pass_by_ref)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
+ --> $DIR/test.rs:14:20
+ |
+LL | fn bad(x: &u16, y: &Foo) {}
+ | ^^^^ help: consider passing by value instead: `Foo`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/toml_unknown_key/clippy.toml b/src/tools/clippy/tests/ui-toml/toml_unknown_key/clippy.toml
new file mode 100644
index 000000000..554b87cc5
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_unknown_key/clippy.toml
@@ -0,0 +1,6 @@
+# that one is an error
+foobar = 42
+
+# that one is white-listed
+[third-party]
+clippy-feature = "nightly"
diff --git a/src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.rs b/src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.rs
new file mode 100644
index 000000000..f328e4d9d
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.rs
@@ -0,0 +1 @@
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr b/src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr
new file mode 100644
index 000000000..fe5139c47
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr
@@ -0,0 +1,45 @@
+error: error reading Clippy's configuration file `$DIR/clippy.toml`: unknown field `foobar`, expected one of
+ allow-dbg-in-tests
+ allow-expect-in-tests
+ allow-unwrap-in-tests
+ allowed-scripts
+ arithmetic-allowed
+ array-size-threshold
+ avoid-breaking-exported-api
+ await-holding-invalid-types
+ blacklisted-names
+ cargo-ignore-publish
+ cognitive-complexity-threshold
+ cyclomatic-complexity-threshold
+ disallowed-methods
+ disallowed-types
+ doc-valid-idents
+ enable-raw-pointer-heuristic-for-send
+ enforced-import-renames
+ enum-variant-name-threshold
+ enum-variant-size-threshold
+ literal-representation-threshold
+ max-fn-params-bools
+ max-include-file-size
+ max-struct-bools
+ max-suggested-slice-pattern-length
+ max-trait-bounds
+ msrv
+ pass-by-value-size-limit
+ single-char-binding-names-threshold
+ standard-macro-braces
+ third-party
+ too-large-for-stack
+ too-many-arguments-threshold
+ too-many-lines-threshold
+ trivial-copy-size-limit
+ type-complexity-threshold
+ unreadable-literal-lint-fractions
+ upper-case-acronyms-aggressive
+ vec-box-size-threshold
+ verbose-bit-mask-threshold
+ warn-on-all-wildcard-imports
+ at line 5 column 1
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/unwrap_used/clippy.toml b/src/tools/clippy/tests/ui-toml/unwrap_used/clippy.toml
new file mode 100644
index 000000000..154626ef4
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/unwrap_used/clippy.toml
@@ -0,0 +1 @@
+allow-unwrap-in-tests = true
diff --git a/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.rs b/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.rs
new file mode 100644
index 000000000..0e82fb20e
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.rs
@@ -0,0 +1,73 @@
+// compile-flags: --test
+
+#![allow(unused_mut, clippy::get_first, clippy::from_iter_instead_of_collect)]
+#![warn(clippy::unwrap_used)]
+#![deny(clippy::get_unwrap)]
+
+use std::collections::BTreeMap;
+use std::collections::HashMap;
+use std::collections::VecDeque;
+
+struct GetFalsePositive {
+ arr: [u32; 3],
+}
+
+impl GetFalsePositive {
+ fn get(&self, pos: usize) -> Option<&u32> {
+ self.arr.get(pos)
+ }
+ fn get_mut(&mut self, pos: usize) -> Option<&mut u32> {
+ self.arr.get_mut(pos)
+ }
+}
+
+fn main() {
+ let mut boxed_slice: Box<[u8]> = Box::new([0, 1, 2, 3]);
+ let mut some_slice = &mut [0, 1, 2, 3];
+ let mut some_vec = vec![0, 1, 2, 3];
+ let mut some_vecdeque: VecDeque<_> = some_vec.iter().cloned().collect();
+ let mut some_hashmap: HashMap<u8, char> = HashMap::from_iter(vec![(1, 'a'), (2, 'b')]);
+ let mut some_btreemap: BTreeMap<u8, char> = BTreeMap::from_iter(vec![(1, 'a'), (2, 'b')]);
+ let mut false_positive = GetFalsePositive { arr: [0, 1, 2] };
+
+ {
+ // Test `get().unwrap()`
+ let _ = boxed_slice.get(1).unwrap();
+ let _ = some_slice.get(0).unwrap();
+ let _ = some_vec.get(0).unwrap();
+ let _ = some_vecdeque.get(0).unwrap();
+ let _ = some_hashmap.get(&1).unwrap();
+ let _ = some_btreemap.get(&1).unwrap();
+ #[allow(clippy::unwrap_used)]
+ let _ = false_positive.get(0).unwrap();
+ // Test with deref
+ let _: u8 = *boxed_slice.get(1).unwrap();
+ }
+
+ {
+ // Test `get_mut().unwrap()`
+ *boxed_slice.get_mut(0).unwrap() = 1;
+ *some_slice.get_mut(0).unwrap() = 1;
+ *some_vec.get_mut(0).unwrap() = 1;
+ *some_vecdeque.get_mut(0).unwrap() = 1;
+ // Check false positives
+ #[allow(clippy::unwrap_used)]
+ {
+ *some_hashmap.get_mut(&1).unwrap() = 'b';
+ *some_btreemap.get_mut(&1).unwrap() = 'b';
+ *false_positive.get_mut(0).unwrap() = 1;
+ }
+ }
+
+ {
+ // Test `get().unwrap().foo()` and `get_mut().unwrap().bar()`
+ let _ = some_vec.get(0..1).unwrap().to_vec();
+ let _ = some_vec.get_mut(0..1).unwrap().to_vec();
+ }
+}
+
+#[test]
+fn test() {
+ let boxed_slice: Box<[u8]> = Box::new([0, 1, 2, 3]);
+ let _ = boxed_slice.get(1).unwrap();
+}
diff --git a/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr b/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr
new file mode 100644
index 000000000..6bcfa0a8b
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr
@@ -0,0 +1,197 @@
+error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:35:17
+ |
+LL | let _ = boxed_slice.get(1).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&boxed_slice[1]`
+ |
+note: the lint level is defined here
+ --> $DIR/unwrap_used.rs:5:9
+ |
+LL | #![deny(clippy::get_unwrap)]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:35:17
+ |
+LL | let _ = boxed_slice.get(1).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::unwrap-used` implied by `-D warnings`
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:36:17
+ |
+LL | let _ = some_slice.get(0).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_slice[0]`
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:36:17
+ |
+LL | let _ = some_slice.get(0).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:37:17
+ |
+LL | let _ = some_vec.get(0).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vec[0]`
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:37:17
+ |
+LL | let _ = some_vec.get(0).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:38:17
+ |
+LL | let _ = some_vecdeque.get(0).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vecdeque[0]`
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:38:17
+ |
+LL | let _ = some_vecdeque.get(0).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:39:17
+ |
+LL | let _ = some_hashmap.get(&1).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_hashmap[&1]`
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:39:17
+ |
+LL | let _ = some_hashmap.get(&1).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:40:17
+ |
+LL | let _ = some_btreemap.get(&1).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_btreemap[&1]`
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:40:17
+ |
+LL | let _ = some_btreemap.get(&1).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:44:21
+ |
+LL | let _: u8 = *boxed_slice.get(1).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `boxed_slice[1]`
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:44:22
+ |
+LL | let _: u8 = *boxed_slice.get(1).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:49:9
+ |
+LL | *boxed_slice.get_mut(0).unwrap() = 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `boxed_slice[0]`
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:49:10
+ |
+LL | *boxed_slice.get_mut(0).unwrap() = 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:50:9
+ |
+LL | *some_slice.get_mut(0).unwrap() = 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_slice[0]`
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:50:10
+ |
+LL | *some_slice.get_mut(0).unwrap() = 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:51:9
+ |
+LL | *some_vec.get_mut(0).unwrap() = 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0]`
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:51:10
+ |
+LL | *some_vec.get_mut(0).unwrap() = 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:52:9
+ |
+LL | *some_vecdeque.get_mut(0).unwrap() = 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vecdeque[0]`
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:52:10
+ |
+LL | *some_vecdeque.get_mut(0).unwrap() = 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:64:17
+ |
+LL | let _ = some_vec.get(0..1).unwrap().to_vec();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:64:17
+ |
+LL | let _ = some_vec.get(0..1).unwrap().to_vec();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:65:17
+ |
+LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
+
+error: used `unwrap()` on `an Option` value
+ --> $DIR/unwrap_used.rs:65:17
+ |
+LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
+
+error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
+ --> $DIR/unwrap_used.rs:72:13
+ |
+LL | let _ = boxed_slice.get(1).unwrap();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&boxed_slice[1]`
+
+error: aborting due to 27 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/update-all-references.sh b/src/tools/clippy/tests/ui-toml/update-all-references.sh
new file mode 100755
index 000000000..4391499a1
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/update-all-references.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+echo "Please use 'cargo dev bless' instead."
diff --git a/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/clippy.toml b/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/clippy.toml
new file mode 100644
index 000000000..cc94ec53e
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/clippy.toml
@@ -0,0 +1 @@
+upper-case-acronyms-aggressive = true
diff --git a/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs b/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs
new file mode 100644
index 000000000..1a5cf1b19
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs
@@ -0,0 +1,44 @@
+#![warn(clippy::upper_case_acronyms)]
+
+struct HTTPResponse; // not linted by default, but with cfg option
+
+struct CString; // not linted
+
+enum Flags {
+ NS, // not linted
+ CWR,
+ ECE,
+ URG,
+ ACK,
+ PSH,
+ RST,
+ SYN,
+ FIN,
+}
+
+// linted with cfg option, beware that lint suggests `GccllvmSomething` instead of
+// `GccLlvmSomething`
+struct GCCLLVMSomething;
+
+// don't warn on public items
+pub struct MIXEDCapital;
+
+pub struct FULLCAPITAL;
+
+// enum variants should not be linted if the num is pub
+pub enum ParseError<T> {
+ FULLCAPITAL(u8),
+ MIXEDCapital(String),
+ Utf8(std::string::FromUtf8Error),
+ Parse(T, String),
+}
+
+// private, do lint here
+enum ParseErrorPrivate<T> {
+ WASD(u8),
+ WASDMixed(String),
+ Utf8(std::string::FromUtf8Error),
+ Parse(T, String),
+}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr b/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr
new file mode 100644
index 000000000..02f29bbef
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr
@@ -0,0 +1,82 @@
+error: name `HTTPResponse` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:3:8
+ |
+LL | struct HTTPResponse; // not linted by default, but with cfg option
+ | ^^^^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `HttpResponse`
+ |
+ = note: `-D clippy::upper-case-acronyms` implied by `-D warnings`
+
+error: name `NS` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:8:5
+ |
+LL | NS, // not linted
+ | ^^ help: consider making the acronym lowercase, except the initial letter (notice the capitalization): `Ns`
+
+error: name `CWR` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:9:5
+ |
+LL | CWR,
+ | ^^^ help: consider making the acronym lowercase, except the initial letter: `Cwr`
+
+error: name `ECE` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:10:5
+ |
+LL | ECE,
+ | ^^^ help: consider making the acronym lowercase, except the initial letter: `Ece`
+
+error: name `URG` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:11:5
+ |
+LL | URG,
+ | ^^^ help: consider making the acronym lowercase, except the initial letter: `Urg`
+
+error: name `ACK` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:12:5
+ |
+LL | ACK,
+ | ^^^ help: consider making the acronym lowercase, except the initial letter (notice the capitalization): `Ack`
+
+error: name `PSH` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:13:5
+ |
+LL | PSH,
+ | ^^^ help: consider making the acronym lowercase, except the initial letter: `Psh`
+
+error: name `RST` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:14:5
+ |
+LL | RST,
+ | ^^^ help: consider making the acronym lowercase, except the initial letter: `Rst`
+
+error: name `SYN` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:15:5
+ |
+LL | SYN,
+ | ^^^ help: consider making the acronym lowercase, except the initial letter: `Syn`
+
+error: name `FIN` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:16:5
+ |
+LL | FIN,
+ | ^^^ help: consider making the acronym lowercase, except the initial letter: `Fin`
+
+error: name `GCCLLVMSomething` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:21:8
+ |
+LL | struct GCCLLVMSomething;
+ | ^^^^^^^^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `GccllvmSomething`
+
+error: name `WASD` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:38:5
+ |
+LL | WASD(u8),
+ | ^^^^ help: consider making the acronym lowercase, except the initial letter: `Wasd`
+
+error: name `WASDMixed` contains a capitalized acronym
+ --> $DIR/upper_case_acronyms.rs:39:5
+ |
+LL | WASDMixed(String),
+ | ^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `WasdMixed`
+
+error: aborting due to 13 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/vec_box_sized/clippy.toml b/src/tools/clippy/tests/ui-toml/vec_box_sized/clippy.toml
new file mode 100644
index 000000000..039ea47fc
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/vec_box_sized/clippy.toml
@@ -0,0 +1 @@
+vec-box-size-threshold = 4
diff --git a/src/tools/clippy/tests/ui-toml/vec_box_sized/test.rs b/src/tools/clippy/tests/ui-toml/vec_box_sized/test.rs
new file mode 100644
index 000000000..bf04bee16
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/vec_box_sized/test.rs
@@ -0,0 +1,15 @@
+struct S {
+ x: u64,
+}
+
+struct C {
+ y: u16,
+}
+
+struct Foo(Vec<Box<u8>>);
+struct Bar(Vec<Box<u32>>);
+struct Baz(Vec<Box<(u32, u32)>>);
+struct BarBaz(Vec<Box<S>>);
+struct FooBarBaz(Vec<Box<C>>);
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/vec_box_sized/test.stderr b/src/tools/clippy/tests/ui-toml/vec_box_sized/test.stderr
new file mode 100644
index 000000000..cf194de3c
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/vec_box_sized/test.stderr
@@ -0,0 +1,22 @@
+error: `Vec<T>` is already on the heap, the boxing is unnecessary
+ --> $DIR/test.rs:9:12
+ |
+LL | struct Foo(Vec<Box<u8>>);
+ | ^^^^^^^^^^^^ help: try: `Vec<u8>`
+ |
+ = note: `-D clippy::vec-box` implied by `-D warnings`
+
+error: `Vec<T>` is already on the heap, the boxing is unnecessary
+ --> $DIR/test.rs:10:12
+ |
+LL | struct Bar(Vec<Box<u32>>);
+ | ^^^^^^^^^^^^^ help: try: `Vec<u32>`
+
+error: `Vec<T>` is already on the heap, the boxing is unnecessary
+ --> $DIR/test.rs:13:18
+ |
+LL | struct FooBarBaz(Vec<Box<C>>);
+ | ^^^^^^^^^^^ help: try: `Vec<C>`
+
+error: aborting due to 3 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/zero_single_char_names/clippy.toml b/src/tools/clippy/tests/ui-toml/zero_single_char_names/clippy.toml
new file mode 100644
index 000000000..42a1067b9
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/zero_single_char_names/clippy.toml
@@ -0,0 +1 @@
+single-char-binding-names-threshold = 0
diff --git a/src/tools/clippy/tests/ui-toml/zero_single_char_names/zero_single_char_names.rs b/src/tools/clippy/tests/ui-toml/zero_single_char_names/zero_single_char_names.rs
new file mode 100644
index 000000000..22aaa242b
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/zero_single_char_names/zero_single_char_names.rs
@@ -0,0 +1,3 @@
+#![warn(clippy::many_single_char_names)]
+
+fn main() {}