Skip to content

Commit

Permalink
Fixes problem with lint warnings in different versions of Rust.
Browse files Browse the repository at this point in the history
- The crate supports several different versions of rust and in some of
  these versions the Clippy lint tool introduces new warnings that are
  not present in previous versions of rust. This causes a warning when
  compiling. This has been fixed in this commit by using the
  `rustversion` crate to only add the lint if the crate is being built
  with a version of Rust that has it.

Signed-off-by: Jesper Brynolf <[email protected]>
  • Loading branch information
Superhepper committed Aug 2, 2023
1 parent 6ad4b5f commit 8d47806
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions tss-esapi-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ links = "tss2-esys"
bindgen = { version = "0.63.0", optional = true }
pkg-config = "0.3.18"
target-lexicon = "0.12.0"
rustversion = "1.0.14"

[features]
generate-bindings = ["bindgen"]
2 changes: 1 addition & 1 deletion tss-esapi-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn main() {
}

#[cfg(feature = "generate-bindings")]
#[allow(clippy::uninlined_format_args)]
#[rustversion::attr(since(1.66), allow(clippy::uninlined_format_args))]
pub fn generate_from_system(esapi_out: PathBuf) {
pkg_config::Config::new()
.atleast_version(MINIMUM_VERSION)
Expand Down
2 changes: 2 additions & 0 deletions tss-esapi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ picky-asn1-x509 = { version = "0.6.1", optional = true }
cfg-if = "1.0.0"
strum = { version = "0.25.0", optional = true }
strum_macros = { version = "0.25.0", optional = true }
rustversion = "1.0.14"

[dev-dependencies]
env_logger = "0.9.0"
sha2 = "0.10.1"

[build-dependencies]
semver = "1.0.7"
rustversion = "1.0.14"

[features]
default = ["abstraction"]
Expand Down
2 changes: 1 addition & 1 deletion tss-esapi/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
use semver::{Version, VersionReq};

#[allow(clippy::uninlined_format_args)]
#[rustversion::attr(since(1.66), allow(clippy::uninlined_format_args))]
fn main() {
let tss_version_string = std::env::var("DEP_TSS2_ESYS_VERSION")
.expect("Failed to parse ENV variable DEP_TSS2_ESYS_VERSION as string");
Expand Down
2 changes: 1 addition & 1 deletion tss-esapi/src/tcti_ldr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl TctiNameConf {
}
}

#[allow(clippy::uninlined_format_args)]
#[rustversion::attr(since(1.66), allow(clippy::uninlined_format_args))]
impl TryFrom<TctiNameConf> for CString {
type Error = Error;

Expand Down

0 comments on commit 8d47806

Please sign in to comment.