Skip to content

Commit

Permalink
Fixed broken rustc test, segregated nightly only lints
Browse files Browse the repository at this point in the history
  • Loading branch information
CraZySacX committed Mar 5, 2021
1 parent 66d6b66 commit e955ce9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -30,6 +30,7 @@ thiserror = "1"

[build-dependencies]
chrono = "0"
rustversion = "1"

[dev-dependencies]
lazy_static = "1"
Expand Down
10 changes: 10 additions & 0 deletions build.rs
@@ -1,10 +1,20 @@
use chrono::Utc;

pub fn main() {
// These are here so some doc tests work
let now = Utc::now();
println!(
"cargo:rustc-env=VERGEN_BUILD_TIMESTAMP={}",
now.to_rfc3339()
);
println!("cargo:rustc-env=VERGEN_GIT_SEMVER=v3.2.0-86-g95fc0f5");
nightly_lints();
}

#[rustversion::nightly]
fn nightly_lints() {
println!("cargo:rustc-cfg=nightly_lints");
}

#[rustversion::not(nightly)]
fn nightly_lints() {}
2 changes: 1 addition & 1 deletion src/gen.rs
Expand Up @@ -273,7 +273,7 @@ mod test {
r#"cargo:rustc-env=VERGEN_RUSTC_COMMIT_HASH=[0-9a-f]{40}"#;
static ref RUSTC_HT_RE_STR: &'static str = r#"cargo:rustc-env=VERGEN_RUSTC_HOST_TRIPLE=.*"#;
static ref RUSTC_LLVM_RE_STR: &'static str =
r#"cargo:rustc-env=VERGEN_RUSTC_LLVM_VERSION=11.0"#;
r#"cargo:rustc-env=VERGEN_RUSTC_LLVM_VERSION=\d{2}\.\d{1}"#;
static ref RUSTC_SEMVER_RE_STR: &'static str = r#"cargo:rustc-env=VERGEN_RUSTC_SEMVER=(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?"#;
static ref RUSTC_NIGHTLY_REGEX: Regex = {
let re_str = vec![
Expand Down
18 changes: 14 additions & 4 deletions src/lib.rs
Expand Up @@ -149,7 +149,6 @@
bare_trait_objects,
bindings_with_variant_name,
box_pointers,
broken_intra_doc_links,
cenum_impl_drop_cast,
clashing_extern_declarations,
clippy::all,
Expand All @@ -173,16 +172,13 @@
incomplete_features,
indirect_structural_match,
inline_no_sanitize,
invalid_codeblock_attributes,
invalid_html_tags,
invalid_value,
irrefutable_let_patterns,
keyword_idents,
late_bound_lifetime_arguments,
macro_use_extern_crate,
meta_variable_misuse,
missing_copy_implementations,
missing_crate_level_docs,
missing_debug_implementations,
// missing_doc_code_examples,
missing_docs,
Expand Down Expand Up @@ -248,6 +244,20 @@
where_clauses_object_safety,
while_true,
)]
#![cfg(nightly_lints)]
#![deny(
rustdoc::broken_intra_doc_links,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_html_tags,
rustdoc::missing_crate_level_docs
)]
#![cfg(not(nightly_lints))]
#![deny(
broken_intra_doc_links,
invalid_codeblock_attributes,
invalid_html_tags,
missing_crate_level_docs
)]
#![allow(clippy::multiple_crate_versions)]

mod config;
Expand Down

0 comments on commit e955ce9

Please sign in to comment.