-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the attribute placeholder if the
cfg_attr
couldn't be parsed
- Loading branch information
Showing
4 changed files
with
131 additions
and
20 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,15 @@ | ||
//@ edition:2018 | ||
//@ aux-build:removing-extern-crate.rs | ||
//@ run-rustfix | ||
|
||
#![warn(rust_2018_idioms)] | ||
|
||
//~ WARNING unused `extern crate` | ||
//~ WARNING unused `extern crate` | ||
|
||
mod another { | ||
//~ WARNING unused `extern crate` | ||
//~ WARNING unused `extern crate` | ||
} | ||
|
||
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,17 @@ | ||
//@ edition:2018 | ||
//@ aux-build:removing-extern-crate.rs | ||
//@ run-rustfix | ||
|
||
#![warn(rust_2018_idioms)] | ||
|
||
#[cfg_attr(test, "macro_use")] //~ ERROR expected | ||
extern crate removing_extern_crate as foo; //~ WARNING unused `extern crate` | ||
extern crate core; //~ WARNING unused `extern crate` | ||
|
||
mod another { | ||
#[cfg_attr(test)] //~ ERROR expected | ||
extern crate removing_extern_crate as foo; //~ WARNING unused `extern crate` | ||
extern crate core; //~ WARNING unused `extern crate` | ||
} | ||
|
||
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,76 @@ | ||
error: expected identifier, found `"macro_use"` | ||
--> $DIR/removing-extern-crate-malformed-cfg.rs:7:18 | ||
| | ||
LL | #[cfg_attr(test, "macro_use")] | ||
| ^^^^^^^^^^^ expected identifier | ||
| | ||
= help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]` | ||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> | ||
|
||
error: expected one of `(`, `,`, `::`, or `=`, found `<eof>` | ||
--> $DIR/removing-extern-crate-malformed-cfg.rs:12:16 | ||
| | ||
LL | #[cfg_attr(test)] | ||
| ^^^^ expected one of `(`, `,`, `::`, or `=` | ||
| | ||
= help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]` | ||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> | ||
|
||
warning: unused `extern crate` | ||
--> $DIR/removing-extern-crate-malformed-cfg.rs:8:1 | ||
| | ||
LL | extern crate removing_extern_crate as foo; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/removing-extern-crate-malformed-cfg.rs:5:9 | ||
| | ||
LL | #![warn(rust_2018_idioms)] | ||
| ^^^^^^^^^^^^^^^^ | ||
= note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` | ||
help: remove the unused `extern crate` | ||
| | ||
LL - #[cfg_attr(test, "macro_use")] | ||
LL - extern crate removing_extern_crate as foo; | ||
LL + | ||
| | ||
|
||
warning: unused `extern crate` | ||
--> $DIR/removing-extern-crate-malformed-cfg.rs:9:1 | ||
| | ||
LL | extern crate core; | ||
| ^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
help: remove the unused `extern crate` | ||
| | ||
LL - extern crate core; | ||
LL + | ||
| | ||
|
||
warning: unused `extern crate` | ||
--> $DIR/removing-extern-crate-malformed-cfg.rs:13:5 | ||
| | ||
LL | extern crate removing_extern_crate as foo; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
help: remove the unused `extern crate` | ||
| | ||
LL - #[cfg_attr(test)] | ||
LL - extern crate removing_extern_crate as foo; | ||
LL + | ||
| | ||
|
||
warning: unused `extern crate` | ||
--> $DIR/removing-extern-crate-malformed-cfg.rs:14:5 | ||
| | ||
LL | extern crate core; | ||
| ^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
help: remove the unused `extern crate` | ||
| | ||
LL - extern crate core; | ||
LL + | ||
| | ||
|
||
error: aborting due to 2 previous errors; 4 warnings emitted | ||
|