Skip to content

Commit

Permalink
Fixed warning about unknown #[cfg]
Browse files Browse the repository at this point in the history
  • Loading branch information
gammelalf committed Sep 6, 2024
1 parent 95af9ab commit d862c47
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 25 deletions.
14 changes: 5 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
use rustc_version::{version_meta, Channel};
use rustc_version::{version_meta, Channel, VersionMeta};

fn main() {
// Set cfg flags depending on release channel
let channel = match version_meta().unwrap().channel {
Channel::Stable => "CHANNEL_STABLE",
Channel::Beta => "CHANNEL_BETA",
Channel::Nightly => "CHANNEL_NIGHTLY",
Channel::Dev => "CHANNEL_DEV",
};
println!("cargo:rustc-cfg={channel}")
println!("cargo::rustc-check-cfg=cfg(CHANNEL_NIGHTLY)");
if matches!(version_meta(), Ok(VersionMeta { channel: Channel::Nightly, .. })) {
println!("cargo:rustc-cfg=CHANNEL_NIGHTLY");
}
}
2 changes: 1 addition & 1 deletion rorm-db
Submodule rorm-db updated 1 files
+5 −9 build.rs
2 changes: 1 addition & 1 deletion rorm-declaration
Submodule rorm-declaration updated 1 files
+5 −9 build.rs
14 changes: 5 additions & 9 deletions rorm-macro/build.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
use rustc_version::{version_meta, Channel};
use rustc_version::{version_meta, Channel, VersionMeta};

fn main() {
// Set cfg flags depending on release channel
let channel = match version_meta().unwrap().channel {
Channel::Stable => "CHANNEL_STABLE",
Channel::Beta => "CHANNEL_BETA",
Channel::Nightly => "CHANNEL_NIGHTLY",
Channel::Dev => "CHANNEL_DEV",
};
println!("cargo:rustc-cfg={channel}")
println!("cargo::rustc-check-cfg=cfg(CHANNEL_NIGHTLY)");
if matches!(version_meta(), Ok(VersionMeta { channel: Channel::Nightly, .. })) {
println!("cargo:rustc-cfg=CHANNEL_NIGHTLY");
}
}
2 changes: 1 addition & 1 deletion rorm-sql
Submodule rorm-sql updated 1 files
+5 −9 build.rs
5 changes: 1 addition & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
#![cfg_attr(all(doc, CHANNEL_NIGHTLY), feature(doc_auto_cfg))]
#![warn(missing_docs)]

#[cfg(all(
not(doc_auto_cfg),
all(feature = "all-drivers", feature = "postgres-only")
))]
#[cfg(all(feature = "all-drivers", feature = "postgres-only"))]
compile_error!("You cannot enable postgres-only with other drivers active");

pub use rorm_db::{Database, DatabaseConfiguration, DatabaseDriver, Error, Row};
Expand Down

0 comments on commit d862c47

Please sign in to comment.