Skip to content

Commit

Permalink
fix(linux): fix warnings from unexpected_cfgs lint on nightly (#1280)
Browse files Browse the repository at this point in the history
Recently nightly `rustc` enabled `unexpected_cfgs` lint by default.
Since this project uses non-standard cfg names, they started to cause
warnings like below on Linux:

```
warning: unexpected `cfg` condition name: `gtk`
    --> src/lib.rs:1029:17
     |
1029 |       #[cfg(not(gtk))]
     |                 ^^^
     |
     = help: consider using a Cargo feature instead
     = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
              [lints.rust]
              unexpected_cfgs = { level = "warn", check-cfg = ['cfg(gtk)'] }
     = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(gtk)");` to the top of the `build.rs`
     = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
```

Ref: rust-lang/rust#82450

Signed-off-by: rhysd <lin90162@yahoo.co.jp>
  • Loading branch information
rhysd authored May 30, 2024
1 parent a8ef665 commit 4c42a03
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,10 @@ winit = "0.29"
getrandom = "0.2"
http-range = "0.1"
percent-encoding = "2.3"

[lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = [
"cfg(linux)",
"cfg(gtk)",
]

0 comments on commit 4c42a03

Please sign in to comment.