summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui-toml
diff options
context:
space:
mode:
Diffstat (limited to '')
-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/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs24
-rw-r--r--src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr2
-rw-r--r--src/tools/clippy/tests/ui-toml/bad_toml_type/clippy.toml2
-rw-r--r--src/tools/clippy/tests/ui-toml/bad_toml_type/conf_bad_type.stderr2
-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.toml5
-rw-r--r--src/tools/clippy/tests/ui-toml/conf_deprecated_key/conf_deprecated_key.rs12
-rw-r--r--src/tools/clippy/tests/ui-toml/conf_deprecated_key/conf_deprecated_key.stderr15
-rw-r--r--src/tools/clippy/tests/ui-toml/disallowed_macros/auxiliary/macros.rs32
-rw-r--r--src/tools/clippy/tests/ui-toml/disallowed_macros/clippy.toml11
-rw-r--r--src/tools/clippy/tests/ui-toml/disallowed_macros/disallowed_macros.rs39
-rw-r--r--src/tools/clippy/tests/ui-toml/disallowed_macros/disallowed_macros.stderr84
-rw-r--r--src/tools/clippy/tests/ui-toml/disallowed_names_append/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/disallowed_names_append/disallowed_names.rs10
-rw-r--r--src/tools/clippy/tests/ui-toml/disallowed_names_append/disallowed_names.stderr16
-rw-r--r--src/tools/clippy/tests/ui-toml/disallowed_names_replace/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/disallowed_names_replace/disallowed_names.rs10
-rw-r--r--src/tools/clippy/tests/ui-toml/disallowed_names_replace/disallowed_names.stderr10
-rw-r--r--src/tools/clippy/tests/ui-toml/duplicated_keys/clippy.toml5
-rw-r--r--src/tools/clippy/tests/ui-toml/duplicated_keys/duplicated_keys.rs1
-rw-r--r--src/tools/clippy/tests/ui-toml/duplicated_keys/duplicated_keys.stderr8
-rw-r--r--src/tools/clippy/tests/ui-toml/expect_used/expect_used.stderr2
-rw-r--r--src/tools/clippy/tests/ui-toml/fn_params_excessive_bools/test.stderr2
-rw-r--r--src/tools/clippy/tests/ui-toml/large_include_file/large_include_file.stderr2
-rw-r--r--src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.fixed62
-rw-r--r--src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs2
-rw-r--r--src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.stderr77
-rw-r--r--src/tools/clippy/tests/ui-toml/strict_non_send_fields_in_send_ty/test.stderr2
-rw-r--r--src/tools/clippy/tests/ui-toml/struct_excessive_bools/test.stderr2
-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_disallow/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_disallow/conf_french_disallowed_name.rs20
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_disallow/conf_french_disallowed_name.stderr46
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_disallowed_methods/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs6
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.stderr24
-rw-r--r--src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr5
-rw-r--r--src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr2
48 files changed, 467 insertions, 220 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
deleted file mode 100644
index 195fabdbf..000000000
--- a/src/tools/clippy/tests/ui-toml/arithmetic_allowed/arithmetic_allowed.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#![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
deleted file mode 100644
index cc40570b1..000000000
--- a/src/tools/clippy/tests/ui-toml/arithmetic_allowed/clippy.toml
+++ /dev/null
@@ -1 +0,0 @@
-arithmetic-allowed = ["Point"]
diff --git a/src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs b/src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs
new file mode 100644
index 000000000..1aed09b7c
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs
@@ -0,0 +1,24 @@
+#![warn(clippy::arithmetic_side_effects)]
+
+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_side_effects_allowed/clippy.toml b/src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed/clippy.toml
new file mode 100644
index 000000000..e736256f2
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed/clippy.toml
@@ -0,0 +1 @@
+arithmetic-side-effects-allowed = ["Point"]
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
index 62c45b546..4c7599843 100644
--- 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
@@ -4,8 +4,8 @@ error: `std::string::String` may not be held across an `await` point per `clippy
LL | let _x = String::from("hello");
| ^^
|
- = note: `-D clippy::await-holding-invalid-type` implied by `-D warnings`
= note: strings are bad
+ = note: `-D clippy::await-holding-invalid-type` implied by `-D warnings`
error: `std::net::Ipv4Addr` may not be held across an `await` point per `clippy.toml`
--> $DIR/await_holding_invalid_type.rs:10:9
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
index 168675394..d48bab08f 100644
--- a/src/tools/clippy/tests/ui-toml/bad_toml_type/clippy.toml
+++ b/src/tools/clippy/tests/ui-toml/bad_toml_type/clippy.toml
@@ -1 +1 @@
-blacklisted-names = 42
+disallowed-names = 42
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
index c7bc261de..e3ec60192 100644
--- 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
@@ -1,4 +1,4 @@
-error: error reading Clippy's configuration file `$DIR/clippy.toml`: invalid type: integer `42`, expected a sequence for key `blacklisted-names`
+error: error reading Clippy's configuration file `$DIR/clippy.toml`: invalid type: integer `42`, expected a sequence for key `disallowed-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
deleted file mode 100644
index fb2395cf9..000000000
--- a/src/tools/clippy/tests/ui-toml/blacklisted_names_append/blacklisted_names.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-#[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
deleted file mode 100644
index 9169bb0e8..000000000
--- a/src/tools/clippy/tests/ui-toml/blacklisted_names_append/blacklisted_names.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 0e052ef50..000000000
--- a/src/tools/clippy/tests/ui-toml/blacklisted_names_append/clippy.toml
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 100644
index fb2395cf9..000000000
--- a/src/tools/clippy/tests/ui-toml/blacklisted_names_replace/blacklisted_names.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-#[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
deleted file mode 100644
index ec6f7f084..000000000
--- a/src/tools/clippy/tests/ui-toml/blacklisted_names_replace/blacklisted_names.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-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
deleted file mode 100644
index 4582f1c06..000000000
--- a/src/tools/clippy/tests/ui-toml/blacklisted_names_replace/clippy.toml
+++ /dev/null
@@ -1 +0,0 @@
-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
index ac47b1950..d79a98d05 100644
--- a/src/tools/clippy/tests/ui-toml/conf_deprecated_key/clippy.toml
+++ b/src/tools/clippy/tests/ui-toml/conf_deprecated_key/clippy.toml
@@ -1,5 +1,6 @@
-# that one is an error
-cyclomatic-complexity-threshold = 42
+# Expect errors from these deprecated configs
+cyclomatic-complexity-threshold = 2
+blacklisted-names = [ "..", "wibble" ]
# that one is white-listed
[third-party]
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
index f328e4d9d..7f1c512d7 100644
--- 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
@@ -1 +1,13 @@
+#![allow(clippy::uninlined_format_args)]
+
fn main() {}
+
+#[warn(clippy::cognitive_complexity)]
+fn cognitive_complexity() {
+ let x = vec![1, 2, 3];
+ for i in x {
+ if i == 1 {
+ println!("{}", i);
+ }
+ }
+}
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
index 90021a034..630bad07c 100644
--- 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
@@ -1,4 +1,15 @@
-error: error reading Clippy's configuration file `$DIR/clippy.toml`: deprecated field `cyclomatic-complexity-threshold`. Please use `cognitive-complexity-threshold` instead
+warning: 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
+warning: error reading Clippy's configuration file `$DIR/clippy.toml`: deprecated field `blacklisted-names`. Please use `disallowed-names` instead
+
+error: the function has a cognitive complexity of (3/2)
+ --> $DIR/conf_deprecated_key.rs:6:4
+ |
+LL | fn cognitive_complexity() {
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: you could split it up into multiple smaller functions
+ = note: `-D clippy::cognitive-complexity` implied by `-D warnings`
+
+error: aborting due to previous error; 2 warnings emitted
diff --git a/src/tools/clippy/tests/ui-toml/disallowed_macros/auxiliary/macros.rs b/src/tools/clippy/tests/ui-toml/disallowed_macros/auxiliary/macros.rs
new file mode 100644
index 000000000..fcaeace0e
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/disallowed_macros/auxiliary/macros.rs
@@ -0,0 +1,32 @@
+#[macro_export]
+macro_rules! expr {
+ () => {
+ 1
+ };
+}
+
+#[macro_export]
+macro_rules! stmt {
+ () => {
+ let _x = ();
+ };
+}
+
+#[macro_export]
+macro_rules! ty {
+ () => { &'static str };
+}
+
+#[macro_export]
+macro_rules! pat {
+ () => {
+ _
+ };
+}
+
+#[macro_export]
+macro_rules! item {
+ () => {
+ const ITEM: usize = 1;
+ };
+}
diff --git a/src/tools/clippy/tests/ui-toml/disallowed_macros/clippy.toml b/src/tools/clippy/tests/ui-toml/disallowed_macros/clippy.toml
new file mode 100644
index 000000000..c8fe8be9a
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/disallowed_macros/clippy.toml
@@ -0,0 +1,11 @@
+disallowed-macros = [
+ "std::println",
+ "std::vec",
+ { path = "std::cfg" },
+ { path = "serde::Serialize", reason = "no serializing" },
+ "macros::expr",
+ "macros::stmt",
+ "macros::ty",
+ "macros::pat",
+ "macros::item",
+]
diff --git a/src/tools/clippy/tests/ui-toml/disallowed_macros/disallowed_macros.rs b/src/tools/clippy/tests/ui-toml/disallowed_macros/disallowed_macros.rs
new file mode 100644
index 000000000..2bb537607
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/disallowed_macros/disallowed_macros.rs
@@ -0,0 +1,39 @@
+// aux-build:macros.rs
+
+#![allow(unused)]
+
+extern crate macros;
+
+use serde::Serialize;
+
+fn main() {
+ println!("one");
+ println!("two");
+ cfg!(unix);
+ vec![1, 2, 3];
+
+ #[derive(Serialize)]
+ struct Derive;
+
+ let _ = macros::expr!();
+ macros::stmt!();
+ let macros::pat!() = 1;
+ let _: macros::ty!() = "";
+ macros::item!();
+
+ eprintln!("allowed");
+}
+
+struct S;
+
+impl S {
+ macros::item!();
+}
+
+trait Y {
+ macros::item!();
+}
+
+impl Y for S {
+ macros::item!();
+}
diff --git a/src/tools/clippy/tests/ui-toml/disallowed_macros/disallowed_macros.stderr b/src/tools/clippy/tests/ui-toml/disallowed_macros/disallowed_macros.stderr
new file mode 100644
index 000000000..aed9feb6f
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/disallowed_macros/disallowed_macros.stderr
@@ -0,0 +1,84 @@
+error: use of a disallowed macro `std::println`
+ --> $DIR/disallowed_macros.rs:10:5
+ |
+LL | println!("one");
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::disallowed-macros` implied by `-D warnings`
+
+error: use of a disallowed macro `std::println`
+ --> $DIR/disallowed_macros.rs:11:5
+ |
+LL | println!("two");
+ | ^^^^^^^^^^^^^^^
+
+error: use of a disallowed macro `std::cfg`
+ --> $DIR/disallowed_macros.rs:12:5
+ |
+LL | cfg!(unix);
+ | ^^^^^^^^^^
+
+error: use of a disallowed macro `std::vec`
+ --> $DIR/disallowed_macros.rs:13:5
+ |
+LL | vec![1, 2, 3];
+ | ^^^^^^^^^^^^^
+
+error: use of a disallowed macro `serde::Serialize`
+ --> $DIR/disallowed_macros.rs:15:14
+ |
+LL | #[derive(Serialize)]
+ | ^^^^^^^^^
+ |
+ = note: no serializing (from clippy.toml)
+
+error: use of a disallowed macro `macros::expr`
+ --> $DIR/disallowed_macros.rs:18:13
+ |
+LL | let _ = macros::expr!();
+ | ^^^^^^^^^^^^^^^
+
+error: use of a disallowed macro `macros::stmt`
+ --> $DIR/disallowed_macros.rs:19:5
+ |
+LL | macros::stmt!();
+ | ^^^^^^^^^^^^^^^
+
+error: use of a disallowed macro `macros::pat`
+ --> $DIR/disallowed_macros.rs:20:9
+ |
+LL | let macros::pat!() = 1;
+ | ^^^^^^^^^^^^^^
+
+error: use of a disallowed macro `macros::ty`
+ --> $DIR/disallowed_macros.rs:21:12
+ |
+LL | let _: macros::ty!() = "";
+ | ^^^^^^^^^^^^^
+
+error: use of a disallowed macro `macros::item`
+ --> $DIR/disallowed_macros.rs:22:5
+ |
+LL | macros::item!();
+ | ^^^^^^^^^^^^^^^
+
+error: use of a disallowed macro `macros::item`
+ --> $DIR/disallowed_macros.rs:30:5
+ |
+LL | macros::item!();
+ | ^^^^^^^^^^^^^^^
+
+error: use of a disallowed macro `macros::item`
+ --> $DIR/disallowed_macros.rs:34:5
+ |
+LL | macros::item!();
+ | ^^^^^^^^^^^^^^^
+
+error: use of a disallowed macro `macros::item`
+ --> $DIR/disallowed_macros.rs:38:5
+ |
+LL | macros::item!();
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to 13 previous errors
+
diff --git a/src/tools/clippy/tests/ui-toml/disallowed_names_append/clippy.toml b/src/tools/clippy/tests/ui-toml/disallowed_names_append/clippy.toml
new file mode 100644
index 000000000..6df96a3c2
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/disallowed_names_append/clippy.toml
@@ -0,0 +1 @@
+disallowed-names = ["ducks", ".."]
diff --git a/src/tools/clippy/tests/ui-toml/disallowed_names_append/disallowed_names.rs b/src/tools/clippy/tests/ui-toml/disallowed_names_append/disallowed_names.rs
new file mode 100644
index 000000000..a2e2b46c4
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/disallowed_names_append/disallowed_names.rs
@@ -0,0 +1,10 @@
+#[warn(clippy::disallowed_names)]
+
+fn main() {
+ // `foo` is part of the default configuration
+ let foo = "bar";
+ // `ducks` was unrightfully disallowed
+ let ducks = ["quack", "quack"];
+ // `fox` is okay
+ let fox = ["what", "does", "the", "fox", "say", "?"];
+}
diff --git a/src/tools/clippy/tests/ui-toml/disallowed_names_append/disallowed_names.stderr b/src/tools/clippy/tests/ui-toml/disallowed_names_append/disallowed_names.stderr
new file mode 100644
index 000000000..23c3e96a8
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/disallowed_names_append/disallowed_names.stderr
@@ -0,0 +1,16 @@
+error: use of a disallowed/placeholder name `foo`
+ --> $DIR/disallowed_names.rs:5:9
+ |
+LL | let foo = "bar";
+ | ^^^
+ |
+ = note: `-D clippy::disallowed-names` implied by `-D warnings`
+
+error: use of a disallowed/placeholder name `ducks`
+ --> $DIR/disallowed_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/disallowed_names_replace/clippy.toml b/src/tools/clippy/tests/ui-toml/disallowed_names_replace/clippy.toml
new file mode 100644
index 000000000..a1c515652
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/disallowed_names_replace/clippy.toml
@@ -0,0 +1 @@
+disallowed-names = ["ducks"]
diff --git a/src/tools/clippy/tests/ui-toml/disallowed_names_replace/disallowed_names.rs b/src/tools/clippy/tests/ui-toml/disallowed_names_replace/disallowed_names.rs
new file mode 100644
index 000000000..a2e2b46c4
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/disallowed_names_replace/disallowed_names.rs
@@ -0,0 +1,10 @@
+#[warn(clippy::disallowed_names)]
+
+fn main() {
+ // `foo` is part of the default configuration
+ let foo = "bar";
+ // `ducks` was unrightfully disallowed
+ let ducks = ["quack", "quack"];
+ // `fox` is okay
+ let fox = ["what", "does", "the", "fox", "say", "?"];
+}
diff --git a/src/tools/clippy/tests/ui-toml/disallowed_names_replace/disallowed_names.stderr b/src/tools/clippy/tests/ui-toml/disallowed_names_replace/disallowed_names.stderr
new file mode 100644
index 000000000..d961fa340
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/disallowed_names_replace/disallowed_names.stderr
@@ -0,0 +1,10 @@
+error: use of a disallowed/placeholder name `ducks`
+ --> $DIR/disallowed_names.rs:7:9
+ |
+LL | let ducks = ["quack", "quack"];
+ | ^^^^^
+ |
+ = note: `-D clippy::disallowed-names` implied by `-D warnings`
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui-toml/duplicated_keys/clippy.toml b/src/tools/clippy/tests/ui-toml/duplicated_keys/clippy.toml
new file mode 100644
index 000000000..63a893cc6
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/duplicated_keys/clippy.toml
@@ -0,0 +1,5 @@
+cognitive-complexity-threshold = 2
+# This is the deprecated name for the same key
+cyclomatic-complexity-threshold = 3
+# Check we get duplication warning regardless of order
+cognitive-complexity-threshold = 4
diff --git a/src/tools/clippy/tests/ui-toml/duplicated_keys/duplicated_keys.rs b/src/tools/clippy/tests/ui-toml/duplicated_keys/duplicated_keys.rs
new file mode 100644
index 000000000..f328e4d9d
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/duplicated_keys/duplicated_keys.rs
@@ -0,0 +1 @@
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/duplicated_keys/duplicated_keys.stderr b/src/tools/clippy/tests/ui-toml/duplicated_keys/duplicated_keys.stderr
new file mode 100644
index 000000000..d99490a24
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/duplicated_keys/duplicated_keys.stderr
@@ -0,0 +1,8 @@
+error: error reading Clippy's configuration file `$DIR/clippy.toml`: duplicate field `cognitive_complexity_threshold` (provided as `cyclomatic_complexity_threshold`)
+
+error: error reading Clippy's configuration file `$DIR/clippy.toml`: duplicate field `cognitive-complexity-threshold`
+
+warning: error reading Clippy's configuration file `$DIR/clippy.toml`: deprecated field `cyclomatic-complexity-threshold`. Please use `cognitive-complexity-threshold` instead
+
+error: aborting due to 2 previous errors; 1 warning emitted
+
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
index 9cb2199ed..28a08599c 100644
--- a/src/tools/clippy/tests/ui-toml/expect_used/expect_used.stderr
+++ b/src/tools/clippy/tests/ui-toml/expect_used/expect_used.stderr
@@ -4,8 +4,8 @@ error: used `expect()` on `an Option` value
LL | let _ = opt.expect("");
| ^^^^^^^^^^^^^^
|
+ = help: if this value is `None`, it will panic
= 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
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
index d05adc3d3..87bdb61c6 100644
--- 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
@@ -4,8 +4,8 @@ error: more than 1 bools in function parameters
LL | fn g(_: bool, _: bool) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: `-D clippy::fn-params-excessive-bools` implied by `-D warnings`
= help: consider refactoring bools into two-variant enums
+ = note: `-D clippy::fn-params-excessive-bools` implied by `-D warnings`
error: aborting due to previous error
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
index 6a685a583..7b5fb9e87 100644
--- 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
@@ -4,8 +4,8 @@ error: attempted to include a large file
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: `-D clippy::large-include-file` implied by `-D warnings`
= 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
diff --git a/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.fixed b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.fixed
new file mode 100644
index 000000000..01d135764
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.fixed
@@ -0,0 +1,62 @@
+// aux-build:proc_macro_derive.rs
+// run-rustfix
+
+#![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 _ = matches!({}, ());
+ 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.rs b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs
index 5b4adc868..72883e827 100644
--- 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
@@ -1,4 +1,5 @@
// aux-build:proc_macro_derive.rs
+// run-rustfix
#![warn(clippy::nonstandard_macro_braces)]
@@ -42,6 +43,7 @@ macro_rules! printlnfoo {
fn main() {
let _ = vec! {1, 2, 3};
let _ = format!["ugh {} stop being such a good compiler", "hello"];
+ let _ = matches!{{}, ()};
let _ = quote!(let x = 1;);
let _ = quote::quote!(match match match);
let _ = test!(); // trigger when macro def is inside our own crate
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
index 039b23b1b..7ae381597 100644
--- 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
@@ -1,94 +1,57 @@
error: use of irregular braces for `vec!` macro
- --> $DIR/conf_nonstandard_macro_braces.rs:43:13
+ --> $DIR/conf_nonstandard_macro_braces.rs:44:13
|
LL | let _ = vec! {1, 2, 3};
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ help: consider writing: `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
+ --> $DIR/conf_nonstandard_macro_braces.rs:45: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
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `format!("ugh {} stop being such a good compiler", "hello")`
+
+error: use of irregular braces for `matches!` macro
+ --> $DIR/conf_nonstandard_macro_braces.rs:46:13
|
-LL | let _ = format!["ugh {} stop being such a good compiler", "hello"];
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | let _ = matches!{{}, ()};
+ | ^^^^^^^^^^^^^^^^ help: consider writing: `matches!({}, ())`
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
+ --> $DIR/conf_nonstandard_macro_braces.rs:47:13
|
LL | let _ = quote!(let x = 1;);
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^ help: consider writing: `quote!{let x = 1;}`
error: use of irregular braces for `quote::quote!` macro
- --> $DIR/conf_nonstandard_macro_braces.rs:46:13
+ --> $DIR/conf_nonstandard_macro_braces.rs:48: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);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `quote::quote!{match match match}`
error: use of irregular braces for `vec!` macro
- --> $DIR/conf_nonstandard_macro_braces.rs:18:9
+ --> $DIR/conf_nonstandard_macro_braces.rs:19:9
|
LL | vec!{0, 0, 0}
- | ^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^ help: consider writing: `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
+ --> $DIR/conf_nonstandard_macro_braces.rs:57:12
|
LL | let _: type_pos!(usize) = vec![];
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^ help: consider writing: `type_pos![usize]`
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
+ --> $DIR/conf_nonstandard_macro_braces.rs:59:5
|
LL | eprint!("test if user config overrides defaults");
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `eprint!["test if user config overrides defaults"]`
-error: aborting due to 7 previous errors
+error: aborting due to 8 previous errors
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
index 49eecf18b..c72f8c648 100644
--- 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
@@ -4,13 +4,13 @@ error: some fields in `NoGeneric` are not safe to be sent to another thread
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`
+ = note: `-D clippy::non-send-fields-in-send-ty` implied by `-D warnings`
error: some fields in `MultiField<T>` are not safe to be sent to another thread
--> $DIR/test.rs:19:1
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
index 65861d10d..4e7c70d18 100644
--- a/src/tools/clippy/tests/ui-toml/struct_excessive_bools/test.stderr
+++ b/src/tools/clippy/tests/ui-toml/struct_excessive_bools/test.stderr
@@ -6,8 +6,8 @@ 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
+ = note: `-D clippy::struct-excessive-bools` implied by `-D warnings`
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
deleted file mode 100644
index 6abe5a3bb..000000000
--- a/src/tools/clippy/tests/ui-toml/toml_blacklist/clippy.toml
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 100644
index cb35d0e85..000000000
--- a/src/tools/clippy/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-#![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
deleted file mode 100644
index 84ba77851..000000000
--- a/src/tools/clippy/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.stderr
+++ /dev/null
@@ -1,46 +0,0 @@
-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_disallow/clippy.toml b/src/tools/clippy/tests/ui-toml/toml_disallow/clippy.toml
new file mode 100644
index 000000000..e4f0cb6df
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_disallow/clippy.toml
@@ -0,0 +1 @@
+disallowed-names = ["toto", "tata", "titi"]
diff --git a/src/tools/clippy/tests/ui-toml/toml_disallow/conf_french_disallowed_name.rs b/src/tools/clippy/tests/ui-toml/toml_disallow/conf_french_disallowed_name.rs
new file mode 100644
index 000000000..2f86b3eda
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_disallow/conf_french_disallowed_name.rs
@@ -0,0 +1,20 @@
+#![allow(dead_code)]
+#![allow(clippy::single_match)]
+#![allow(unused_variables)]
+#![warn(clippy::disallowed_names)]
+
+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_disallow/conf_french_disallowed_name.stderr b/src/tools/clippy/tests/ui-toml/toml_disallow/conf_french_disallowed_name.stderr
new file mode 100644
index 000000000..9082c1c54
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/toml_disallow/conf_french_disallowed_name.stderr
@@ -0,0 +1,46 @@
+error: use of a disallowed/placeholder name `toto`
+ --> $DIR/conf_french_disallowed_name.rs:6:9
+ |
+LL | fn test(toto: ()) {}
+ | ^^^^
+ |
+ = note: `-D clippy::disallowed-names` implied by `-D warnings`
+
+error: use of a disallowed/placeholder name `toto`
+ --> $DIR/conf_french_disallowed_name.rs:9:9
+ |
+LL | let toto = 42;
+ | ^^^^
+
+error: use of a disallowed/placeholder name `tata`
+ --> $DIR/conf_french_disallowed_name.rs:10:9
+ |
+LL | let tata = 42;
+ | ^^^^
+
+error: use of a disallowed/placeholder name `titi`
+ --> $DIR/conf_french_disallowed_name.rs:11:9
+ |
+LL | let titi = 42;
+ | ^^^^
+
+error: use of a disallowed/placeholder name `toto`
+ --> $DIR/conf_french_disallowed_name.rs:17:10
+ |
+LL | (toto, Some(tata), titi @ Some(_)) => (),
+ | ^^^^
+
+error: use of a disallowed/placeholder name `tata`
+ --> $DIR/conf_french_disallowed_name.rs:17:21
+ |
+LL | (toto, Some(tata), titi @ Some(_)) => (),
+ | ^^^^
+
+error: use of a disallowed/placeholder name `titi`
+ --> $DIR/conf_french_disallowed_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
index c902d2112..28774db62 100644
--- a/src/tools/clippy/tests/ui-toml/toml_disallowed_methods/clippy.toml
+++ b/src/tools/clippy/tests/ui-toml/toml_disallowed_methods/clippy.toml
@@ -3,6 +3,7 @@ disallowed-methods = [
"std::iter::Iterator::sum",
"f32::clamp",
"slice::sort_unstable",
+ "futures::stream::select_all",
# 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
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
index 3397fa1ec..b483f1600 100644
--- 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
@@ -1,6 +1,9 @@
#![warn(clippy::disallowed_methods)]
+extern crate futures;
extern crate regex;
+
+use futures::stream::{empty, select_all};
use regex::Regex;
fn main() {
@@ -20,4 +23,7 @@ fn main() {
let in_call = Box::new(f32::clamp);
let in_method_call = ["^", "$"].into_iter().map(Regex::new);
+
+ // resolve ambiguity between `futures::stream::select_all` the module and the function
+ let same_name_as_module = select_all(vec![empty::<()>()]);
}
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
index 5cbb56754..6d78c32e1 100644
--- 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
@@ -1,5 +1,5 @@
error: use of a disallowed method `regex::Regex::new`
- --> $DIR/conf_disallowed_methods.rs:7:14
+ --> $DIR/conf_disallowed_methods.rs:10:14
|
LL | let re = Regex::new(r"ab.*c").unwrap();
| ^^^^^^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ 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
+ --> $DIR/conf_disallowed_methods.rs:11:5
|
LL | re.is_match("abc");
| ^^^^^^^^^^^^^^^^^^
@@ -15,40 +15,46 @@ 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
+ --> $DIR/conf_disallowed_methods.rs:14:5
|
LL | a.iter().sum::<i32>();
| ^^^^^^^^^^^^^^^^^^^^^
error: use of a disallowed method `slice::sort_unstable`
- --> $DIR/conf_disallowed_methods.rs:13:5
+ --> $DIR/conf_disallowed_methods.rs:16:5
|
LL | a.sort_unstable();
| ^^^^^^^^^^^^^^^^^
error: use of a disallowed method `f32::clamp`
- --> $DIR/conf_disallowed_methods.rs:15:13
+ --> $DIR/conf_disallowed_methods.rs:18: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
+ --> $DIR/conf_disallowed_methods.rs:21: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
+ --> $DIR/conf_disallowed_methods.rs:24: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
+ --> $DIR/conf_disallowed_methods.rs:25:53
|
LL | let in_method_call = ["^", "$"].into_iter().map(Regex::new);
| ^^^^^^^^^^
-error: aborting due to 8 previous errors
+error: use of a disallowed method `futures::stream::select_all`
+ --> $DIR/conf_disallowed_methods.rs:28:31
+ |
+LL | let same_name_as_module = select_all(vec![empty::<()>()]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 9 previous errors
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
index fe5139c47..82ee80541 100644
--- 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
@@ -3,7 +3,7 @@ error: error reading Clippy's configuration file `$DIR/clippy.toml`: unknown fie
allow-expect-in-tests
allow-unwrap-in-tests
allowed-scripts
- arithmetic-allowed
+ arithmetic-side-effects-allowed
array-size-threshold
avoid-breaking-exported-api
await-holding-invalid-types
@@ -11,13 +11,16 @@ error: error reading Clippy's configuration file `$DIR/clippy.toml`: unknown fie
cargo-ignore-publish
cognitive-complexity-threshold
cyclomatic-complexity-threshold
+ disallowed-macros
disallowed-methods
+ disallowed-names
disallowed-types
doc-valid-idents
enable-raw-pointer-heuristic-for-send
enforced-import-renames
enum-variant-name-threshold
enum-variant-size-threshold
+ large-error-threshold
literal-representation-threshold
max-fn-params-bools
max-include-file-size
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
index 6bcfa0a8b..681b5eaf5 100644
--- a/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr
+++ b/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr
@@ -16,8 +16,8 @@ error: used `unwrap()` on `an Option` value
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
+ = note: `-D clippy::unwrap-used` implied by `-D warnings`
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
--> $DIR/unwrap_used.rs:36:17