Skip to content

Commit

Permalink
Merge pull request #176 from thecaralice/clippy
Browse files Browse the repository at this point in the history
fix: prevent clippy lints from occuring in the generated file
  • Loading branch information
baoyachi authored Aug 20, 2024
2 parents 7936e19 + e8a388b commit 63816d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/gen_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const VERSION_BRANCH_CONST: &str = r##"
/// The version string contains the package version, branch, commit hash, build time, and build environment on separate lines.
/// This constant is suitable for printing to the user.
#[allow(dead_code)]
#[allow(clippy::all,clippy::pedantic)]
pub const VERSION:&str = shadow_rs::formatcp!(r#"
pkg_version:{}
branch:{}
Expand All @@ -24,6 +25,7 @@ const VERSION_TAG_CONST: &str = r##"
/// The version string contains the package version, current Git tag, commit hash, build time, and build environment on separate lines.
/// This constant is suitable for printing to the user.
#[allow(dead_code)]
#[allow(clippy::all,clippy::pedantic)]
pub const VERSION:&str = shadow_rs::formatcp!(r#"
pkg_version:{}
tag:{}
Expand All @@ -33,6 +35,7 @@ build_env:{},{}"#,PKG_VERSION, TAG, SHORT_COMMIT, BUILD_TIME, RUST_VERSION, RUST
);"##;

const CLAP_VERSION_BRANCH_CONST: &str = r##"#[allow(dead_code,missing_docs)]
#[allow(clippy::all,clippy::pedantic)]
#[deprecated = "Replaced with `CLAP_LONG_VERSION`"]
pub const CLAP_VERSION:&str = shadow_rs::formatcp!(r#"{}
branch:{}
Expand All @@ -42,6 +45,7 @@ build_env:{},{}"#,PKG_VERSION, BRANCH, SHORT_COMMIT, BUILD_TIME, RUST_VERSION, R
);"##;

const CLAP_VERSION_TAG_CONST: &str = r##"#[allow(dead_code,missing_docs)]
#[allow(clippy::all,clippy::pedantic)]
#[deprecated = "Replaced with `CLAP_LONG_VERSION`"]
pub const CLAP_VERSION:&str = shadow_rs::formatcp!(r#"{}
tag:{}
Expand All @@ -55,6 +59,7 @@ const CLAP_LONG_VERSION_BRANCH_CONST: &str = r##"
/// The version string contains the package version, branch, commit hash, build time, and build environment on separate lines.
/// This constant is intended to be used by clap or other CLI tools as a long version string.
#[allow(dead_code)]
#[allow(clippy::all,clippy::pedantic)]
pub const CLAP_LONG_VERSION:&str = shadow_rs::formatcp!(r#"{}
branch:{}
commit_hash:{}
Expand All @@ -67,6 +72,7 @@ const CLAP_LONG_VERSION_TAG_CONST: &str = r##"
/// The version string contains the package version, current Git tag, commit hash, build time, and build environment on separate lines.
/// This constant is intended to be used by clap or other CLI tools as a long version string.
#[allow(dead_code)]
#[allow(clippy::all,clippy::pedantic)]
pub const CLAP_LONG_VERSION:&str = shadow_rs::formatcp!(r#"{}
tag:{}
commit_hash:{}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ impl Shadow {
let define = match val.t {
ConstType::Str => format!(
"#[allow(dead_code)]\n\
#[allow(clippy::all)]\n\
#[allow(clippy::all,clippy::pedantic)]\n\
pub const {} :{} = r#\"{}\"#;",
shadow_const.to_ascii_uppercase(),
ConstType::Str,
Expand Down

0 comments on commit 63816d6

Please sign in to comment.