Skip to content

Commit

Permalink
pass docsrs as cfg instead
Browse files Browse the repository at this point in the history
  • Loading branch information
oberrich committed Apr 10, 2024
1 parent 1b4f6b9 commit 8605c0c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ default = []
docsrs = []

[package.metadata.docs.rs]
features = ["docsrs"]
all-features = true
default-target = "x86_64-pc-windows-msvc"
targets = []
targets = ["x86_64-pc-windows-msvc"]
rustdoc-args = ["--cfg", "docsrs"]

[build-dependencies]
windows.features = ["Win32_Foundation"]
Expand Down
2 changes: 1 addition & 1 deletion src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl BindgenConfig {
}

fn main() {
if cfg!(feature = "docsrs") {
if cfg!(docsrs) {
println!("Skipping regeneration of bindings for docs.rs.");
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
/// Bindings for `phnt` (nightly) generated by `bindgen`
pub mod ffi {
// use vendored `generated.rs` for docs.rs
#[cfg(feature = "docsrs")]
#[cfg(docsrs)]
include!("ffi/generated.rs");

// use regenerated bindings in production
#[cfg(not(feature = "docsrs"))]
#[cfg(not(docsrs))]
include!(concat!(env!("OUT_DIR"), "\\generated.rs"));
}

Expand Down

0 comments on commit 8605c0c

Please sign in to comment.