Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent clippy lints from occuring in the generated file #176

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading