Skip to content

Commit 8d47806

Browse files
committed
Fixes problem with lint warnings in different versions of Rust.
- 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 <jesper.brynolf@gmail.com>
1 parent 6ad4b5f commit 8d47806

File tree

5 files changed

+6
-3
lines changed

5 files changed

+6
-3
lines changed

tss-esapi-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ links = "tss2-esys"
1616
bindgen = { version = "0.63.0", optional = true }
1717
pkg-config = "0.3.18"
1818
target-lexicon = "0.12.0"
19+
rustversion = "1.0.14"
1920

2021
[features]
2122
generate-bindings = ["bindgen"]

tss-esapi-sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn main() {
5858
}
5959

6060
#[cfg(feature = "generate-bindings")]
61-
#[allow(clippy::uninlined_format_args)]
61+
#[rustversion::attr(since(1.66), allow(clippy::uninlined_format_args))]
6262
pub fn generate_from_system(esapi_out: PathBuf) {
6363
pkg_config::Config::new()
6464
.atleast_version(MINIMUM_VERSION)

tss-esapi/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ picky-asn1-x509 = { version = "0.6.1", optional = true }
2929
cfg-if = "1.0.0"
3030
strum = { version = "0.25.0", optional = true }
3131
strum_macros = { version = "0.25.0", optional = true }
32+
rustversion = "1.0.14"
3233

3334
[dev-dependencies]
3435
env_logger = "0.9.0"
3536
sha2 = "0.10.1"
3637

3738
[build-dependencies]
3839
semver = "1.0.7"
40+
rustversion = "1.0.14"
3941

4042
[features]
4143
default = ["abstraction"]

tss-esapi/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33
use semver::{Version, VersionReq};
44

5-
#[allow(clippy::uninlined_format_args)]
5+
#[rustversion::attr(since(1.66), allow(clippy::uninlined_format_args))]
66
fn main() {
77
let tss_version_string = std::env::var("DEP_TSS2_ESYS_VERSION")
88
.expect("Failed to parse ENV variable DEP_TSS2_ESYS_VERSION as string");

tss-esapi/src/tcti_ldr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl TctiNameConf {
165165
}
166166
}
167167

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

0 commit comments

Comments
 (0)