-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #96651 - ken-matsui:omit-unnecessary-help-to-add-cfg-…
…test, r=cjgillot Omit unnecessary help to add `#[cfg(test)]` when already annotated Closes: #96611 The related PR is: #91770
- Loading branch information
Showing
3 changed files
with
227 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// compile-flags: --test | ||
|
||
#![deny(unused_imports)] | ||
|
||
use std::io::BufRead; //~ ERROR unused import: `std::io::BufRead` | ||
|
||
fn a() {} | ||
fn b() {} | ||
|
||
mod test { | ||
use super::a; //~ ERROR unused import: `super::a` | ||
|
||
fn foo() { | ||
use crate::b; //~ ERROR unused import: `crate::b` | ||
} | ||
} | ||
|
||
mod tests { | ||
use super::a; //~ ERROR unused import: `super::a` | ||
|
||
fn foo() { | ||
use crate::b; //~ ERROR unused import: `crate::b` | ||
} | ||
} | ||
|
||
mod test_a { | ||
use super::a; //~ ERROR unused import: `super::a` | ||
|
||
fn foo() { | ||
use crate::b; //~ ERROR unused import: `crate::b` | ||
} | ||
} | ||
|
||
mod a_test { | ||
use super::a; //~ ERROR unused import: `super::a` | ||
|
||
fn foo() { | ||
use crate::b; //~ ERROR unused import: `crate::b` | ||
} | ||
} | ||
|
||
mod tests_a { | ||
use super::a; //~ ERROR unused import: `super::a` | ||
|
||
fn foo() { | ||
use crate::b; //~ ERROR unused import: `crate::b` | ||
} | ||
} | ||
|
||
mod a_tests { | ||
use super::a; //~ ERROR unused import: `super::a` | ||
|
||
fn foo() { | ||
use crate::b; //~ ERROR unused import: `crate::b` | ||
} | ||
} | ||
|
||
mod fastest_search { | ||
use super::a; //~ ERROR unused import: `super::a` | ||
|
||
fn foo() { | ||
use crate::b; //~ ERROR unused import: `crate::b` | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod test_has_attr { | ||
use super::a; //~ ERROR unused import: `super::a` | ||
|
||
fn foo() { | ||
use crate::b; //~ ERROR unused import: `crate::b` | ||
} | ||
} | ||
|
||
mod test_has_no_attr { | ||
#[cfg(test)] | ||
use super::a; //~ ERROR unused import: `super::a` | ||
|
||
fn foo() { | ||
use crate::b; //~ ERROR unused import: `crate::b` | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
error: unused import: `std::io::BufRead` | ||
--> $DIR/unused-imports-in-test-mode.rs:5:5 | ||
| | ||
LL | use std::io::BufRead; | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/unused-imports-in-test-mode.rs:3:9 | ||
| | ||
LL | #![deny(unused_imports)] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: unused import: `super::a` | ||
--> $DIR/unused-imports-in-test-mode.rs:11:9 | ||
| | ||
LL | use super::a; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `crate::b` | ||
--> $DIR/unused-imports-in-test-mode.rs:14:13 | ||
| | ||
LL | use crate::b; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `super::a` | ||
--> $DIR/unused-imports-in-test-mode.rs:19:9 | ||
| | ||
LL | use super::a; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `crate::b` | ||
--> $DIR/unused-imports-in-test-mode.rs:22:13 | ||
| | ||
LL | use crate::b; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `super::a` | ||
--> $DIR/unused-imports-in-test-mode.rs:27:9 | ||
| | ||
LL | use super::a; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `crate::b` | ||
--> $DIR/unused-imports-in-test-mode.rs:30:13 | ||
| | ||
LL | use crate::b; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `super::a` | ||
--> $DIR/unused-imports-in-test-mode.rs:35:9 | ||
| | ||
LL | use super::a; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `crate::b` | ||
--> $DIR/unused-imports-in-test-mode.rs:38:13 | ||
| | ||
LL | use crate::b; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `super::a` | ||
--> $DIR/unused-imports-in-test-mode.rs:43:9 | ||
| | ||
LL | use super::a; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `crate::b` | ||
--> $DIR/unused-imports-in-test-mode.rs:46:13 | ||
| | ||
LL | use crate::b; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `super::a` | ||
--> $DIR/unused-imports-in-test-mode.rs:51:9 | ||
| | ||
LL | use super::a; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `crate::b` | ||
--> $DIR/unused-imports-in-test-mode.rs:54:13 | ||
| | ||
LL | use crate::b; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `super::a` | ||
--> $DIR/unused-imports-in-test-mode.rs:59:9 | ||
| | ||
LL | use super::a; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `crate::b` | ||
--> $DIR/unused-imports-in-test-mode.rs:62:13 | ||
| | ||
LL | use crate::b; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `super::a` | ||
--> $DIR/unused-imports-in-test-mode.rs:68:9 | ||
| | ||
LL | use super::a; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `crate::b` | ||
--> $DIR/unused-imports-in-test-mode.rs:71:13 | ||
| | ||
LL | use crate::b; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `super::a` | ||
--> $DIR/unused-imports-in-test-mode.rs:77:9 | ||
| | ||
LL | use super::a; | ||
| ^^^^^^^^ | ||
|
||
error: unused import: `crate::b` | ||
--> $DIR/unused-imports-in-test-mode.rs:80:13 | ||
| | ||
LL | use crate::b; | ||
| ^^^^^^^^ | ||
|
||
error: aborting due to 19 previous errors | ||
|