-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Suggest cfg(false) instead of cfg(FALSE)
#149792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| //! Check that `cfg(false)` is suggested instead of cfg(FALSE) | ||
| // | ||
| //@ check-pass | ||
| //@ no-auto-check-cfg | ||
| //@ compile-flags: --check-cfg=cfg() | ||
|
|
||
| #[cfg(FALSE)] | ||
| //~^ WARNING unexpected `cfg` condition name: `FALSE` | ||
| //~| HELP: to expect this configuration use | ||
| //~| HELP: you may have meant to use `false` (notice the capitalization). | ||
| pub fn a() {} | ||
|
|
||
| #[cfg(False)] | ||
| //~^ WARNING unexpected `cfg` condition name: `False` | ||
| //~| HELP: to expect this configuration use | ||
| //~| HELP: you may have meant to use `false` (notice the capitalization). | ||
| pub fn b() {} | ||
|
|
||
| #[cfg(r#false)] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may want to have a test for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This currently raises the suggestion on |
||
| //~^ WARNING unexpected `cfg` condition name: `r#false` | ||
| //~| HELP: to expect this configuration use | ||
| // No capitalization help for r#false | ||
| pub fn c() {} | ||
|
|
||
| #[cfg(r#False)] | ||
| //~^ WARNING unexpected `cfg` condition name: `False` | ||
| //~| HELP: to expect this configuration use | ||
| // No capitalization help for r#False | ||
| pub fn d() {} | ||
|
|
||
| #[cfg(false)] | ||
| pub fn e() {} | ||
|
|
||
| #[cfg(TRUE)] | ||
| //~^ WARNING unexpected `cfg` condition name: `TRUE` | ||
| //~| HELP: to expect this configuration use | ||
| //~| HELP: you may have meant to use `true` (notice the capitalization). | ||
| pub fn f() {} | ||
|
|
||
| #[cfg(True)] | ||
| //~^ WARNING unexpected `cfg` condition name: `True` | ||
| //~| HELP: to expect this configuration use | ||
| //~| HELP: you may have meant to use `true` (notice the capitalization). | ||
| pub fn g() {} | ||
|
|
||
| #[cfg(r#true)] | ||
| //~^ WARNING unexpected `cfg` condition name: `r#true` | ||
| //~| HELP: to expect this configuration use | ||
| // No capitalization help for r#true | ||
| pub fn h() {} | ||
|
|
||
| #[cfg(r#True)] | ||
| //~^ WARNING unexpected `cfg` condition name: `True` | ||
| //~| HELP: to expect this configuration use | ||
| // No capitalization help for r#True | ||
| pub fn i() {} | ||
|
|
||
| #[cfg(true)] | ||
| pub fn j() {} | ||
|
|
||
| pub fn main() {} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| warning: unexpected `cfg` condition name: `FALSE` | ||
| --> $DIR/false.rs:7:7 | ||
| | | ||
| LL | #[cfg(FALSE)] | ||
| | ^^^^^ | ||
| | | ||
| = help: to expect this configuration use `--check-cfg=cfg(FALSE)` | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
| = note: `#[warn(unexpected_cfgs)]` on by default | ||
| help: you may have meant to use `false` (notice the capitalization). Doing so makes this predicate evaluate to `false` unconditionally | ||
| | | ||
| LL - #[cfg(FALSE)] | ||
| LL + #[cfg(false)] | ||
| | | ||
|
|
||
| warning: unexpected `cfg` condition name: `False` | ||
| --> $DIR/false.rs:13:7 | ||
| | | ||
| LL | #[cfg(False)] | ||
| | ^^^^^ | ||
| | | ||
| = help: to expect this configuration use `--check-cfg=cfg(False)` | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
| help: you may have meant to use `false` (notice the capitalization). Doing so makes this predicate evaluate to `false` unconditionally (notice the capitalization) | ||
| | | ||
| LL - #[cfg(False)] | ||
| LL + #[cfg(false)] | ||
| | | ||
|
|
||
| warning: unexpected `cfg` condition name: `r#false` | ||
| --> $DIR/false.rs:19:7 | ||
| | | ||
| LL | #[cfg(r#false)] | ||
| | ^^^^^^^ | ||
| | | ||
| = help: to expect this configuration use `--check-cfg=cfg(r#false)` | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
|
|
||
| warning: unexpected `cfg` condition name: `False` | ||
| --> $DIR/false.rs:25:7 | ||
| | | ||
| LL | #[cfg(r#False)] | ||
| | ^^^^^^^ | ||
| | | ||
| = help: to expect this configuration use `--check-cfg=cfg(False)` | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
|
|
||
| warning: unexpected `cfg` condition name: `TRUE` | ||
| --> $DIR/false.rs:34:7 | ||
| | | ||
| LL | #[cfg(TRUE)] | ||
| | ^^^^ | ||
| | | ||
| = help: to expect this configuration use `--check-cfg=cfg(TRUE)` | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
| help: you may have meant to use `true` (notice the capitalization). Doing so makes this predicate evaluate to `true` unconditionally | ||
| | | ||
| LL - #[cfg(TRUE)] | ||
| LL + #[cfg(true)] | ||
| | | ||
|
|
||
| warning: unexpected `cfg` condition name: `True` | ||
| --> $DIR/false.rs:40:7 | ||
| | | ||
| LL | #[cfg(True)] | ||
| | ^^^^ | ||
| | | ||
| = help: to expect this configuration use `--check-cfg=cfg(True)` | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
| help: you may have meant to use `true` (notice the capitalization). Doing so makes this predicate evaluate to `true` unconditionally | ||
| | | ||
| LL - #[cfg(True)] | ||
| LL + #[cfg(true)] | ||
| | | ||
|
|
||
| warning: unexpected `cfg` condition name: `r#true` | ||
| --> $DIR/false.rs:46:7 | ||
| | | ||
| LL | #[cfg(r#true)] | ||
| | ^^^^^^ | ||
| | | ||
| = help: to expect this configuration use `--check-cfg=cfg(r#true)` | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
|
|
||
| warning: unexpected `cfg` condition name: `True` | ||
| --> $DIR/false.rs:52:7 | ||
| | | ||
| LL | #[cfg(r#True)] | ||
| | ^^^^^^ | ||
| | | ||
| = help: to expect this configuration use `--check-cfg=cfg(True)` | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
|
|
||
| warning: 8 warnings emitted | ||
|
|
Uh oh!
There was an error while loading. Please reload this page.