about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-09-17 09:29:17 +0000
committerbors <bors@rust-lang.org>2022-09-17 09:29:17 +0000
commite120fb10c60a27670c72e7ec99e93d16c045f493 (patch)
treeeae50fc26e2090189b3ddfdc927921b1ad3ee7cf
parent481dc2e81cf6e5b68095a6baa5d005a2edf59e01 (diff)
parent6d8959ea8374376ee38c972c61e8bfdacb71724f (diff)
downloadrust-e120fb10c60a27670c72e7ec99e93d16c045f493.tar.gz
rust-e120fb10c60a27670c72e7ec99e93d16c045f493.zip
Auto merge of #9488 - Alexendoo:unused, r=llogiq
Add `#[allow(unused)]` to test in `cargo dev new_lint`

`rustfix` tests don't automatically apply `-Aunused` which leads to some tests having `_workarounds`, add it to new test files automatically so people don't have to worry about it

changelog: none
-rw-r--r--book/src/development/adding_lints.md1
-rw-r--r--clippy_dev/src/new_lint.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/book/src/development/adding_lints.md b/book/src/development/adding_lints.md
index da781eb970d..b1e843bc7f4 100644
--- a/book/src/development/adding_lints.md
+++ b/book/src/development/adding_lints.md
@@ -90,6 +90,7 @@ We start by opening the test file created at `tests/ui/foo_functions.rs`.
 Update the file with some examples to get started:
 
 ```rust
+#![allow(unused)]
 #![warn(clippy::foo_functions)]
 
 // Impl methods
diff --git a/clippy_dev/src/new_lint.rs b/clippy_dev/src/new_lint.rs
index be05e67d724..9a68c6e775d 100644
--- a/clippy_dev/src/new_lint.rs
+++ b/clippy_dev/src/new_lint.rs
@@ -186,6 +186,7 @@ pub(crate) fn get_stabilization_version() -> String {
 fn get_test_file_contents(lint_name: &str, header_commands: Option<&str>) -> String {
     let mut contents = format!(
         indoc! {"
+            #![allow(unused)]
             #![warn(clippy::{})]
 
             fn main() {{