Skip to content

Commit 65fbb2e

Browse files
committed
Fixed a number of clippy warnings that came up with Rust 1.97.0 + added 'upgrade' target to the Makefile.
1 parent 706d6e3 commit 65fbb2e

6 files changed

Lines changed: 13 additions & 14 deletions

File tree

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include tools/docker/docker.mk
44

55
DOCKER := $(foreach target,$(DOCKER_TARGETS),docker.$(target))
66

7-
.PHONY: all bench build check clean clippy codecov docs examples fixup fmt libtpms package publish tests $(DOCKER)
7+
.PHONY: all bench build check clean clippy codecov docs examples fmt libtpms package publish tests upgrade $(DOCKER)
88

99
all: clean check build
1010

@@ -20,10 +20,9 @@ clippy: check
2020
cargo clippy --no-default-features -- -D warnings
2121
cargo clippy --all-features --all-targets -- -D warnings
2222

23-
fixup: check
24-
cargo upgrade && cargo update
25-
cargo fmt --all
26-
cargo clippy --all-features --all-targets
23+
upgrade:
24+
cargo upgrade -i
25+
cargo update
2726

2827
tests:
2928
CARGO_PROFILE_RELEASE_DEBUG=true RUST_BACKTRACE=1 RUST_LOG=info TSS2_LOG="all+none" \

benches/fapi_benchmark.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ mod bench_fapi {
7171
let mut manager = TpmManager::new();
7272

7373
// Create siging key
74-
let sign_key_path = format!("{}/sign_key", &manager.1);
74+
let sign_key_path = format!("{}/sign_key", manager.1);
7575
manager.0.create_key(&sign_key_path, Some(&FLAGS_SIGNING), None, None).expect("Failed to create sign key!");
7676

7777
// Generate random message
@@ -96,7 +96,7 @@ mod bench_fapi {
9696
let mut manager = TpmManager::new();
9797

9898
// Create siging key
99-
let sign_key_path = format!("{}/sign_key", &manager.1);
99+
let sign_key_path = format!("{}/sign_key", manager.1);
100100
manager.0.create_key(&sign_key_path, Some(&FLAGS_SIGNING), None, None).expect("Failed to create sign key!");
101101

102102
// Generate random message

src/callback.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ impl CallbackManager {
459459
fn auth_cb(&self, object_path: &CStr, description: Option<&CStr>) -> Result<CbResult<CStringPointer>, CbError> {
460460
let mut lock = self.0.lock().unwrap();
461461
let param = AuthCbParam::new(object_path, description)?;
462-
trace!("Callbacks::auth_cb({:?})", &param);
462+
trace!("Callbacks::auth_cb({:?})", param);
463463
match lock.callbacks.auth_cb(param) {
464464
Ok(auth_value) => Ok(Ok(lock.temp.set_string(CStringHolder::try_from(auth_value).map_err(|_| CbError::InvalidValue)?))),
465465
Err(error) => Ok(Err(error)),
@@ -477,7 +477,7 @@ impl CallbackManager {
477477
) -> Result<CbResult<RawSlice>, CbError> {
478478
let mut lock = self.0.lock().unwrap();
479479
let param = SignCbParam::new(object_path, description, public_key, key_hint, hash_algo, challenge)?;
480-
trace!("Callbacks::sign_cb({:?})", &param);
480+
trace!("Callbacks::sign_cb({:?})", param);
481481
match lock.callbacks.sign_cb(param) {
482482
Ok(signature) => Ok(Ok(lock.temp.set_data(CBinaryHolder::try_from(signature).map_err(|_| CbError::InvalidValue)?))),
483483
Err(error) => Ok(Err(error)),
@@ -487,7 +487,7 @@ impl CallbackManager {
487487
fn branch_cb(&self, object_path: &CStr, description: Option<&CStr>, branches: &[&CStr]) -> Result<CbResult<usize>, CbError> {
488488
let mut lock = self.0.lock().unwrap();
489489
let param = BranchCbParam::new(object_path, description, branches)?;
490-
trace!("Callbacks::branch_cb({:?})", &param);
490+
trace!("Callbacks::branch_cb({:?})", param);
491491
Ok(lock.callbacks.branch_cb(param).inspect(|&index| {
492492
assert!(index < branches.len(), "The chosen branch index #{} is out of range!", index);
493493
}))
@@ -496,7 +496,7 @@ impl CallbackManager {
496496
fn policy_action_cb(&self, object_path: &CStr, action: Option<&CStr>) -> Result<CbResult<()>, CbError> {
497497
let mut lock = self.0.lock().unwrap();
498498
let param = PolicyActionCbParam::new(object_path, action)?;
499-
trace!("Callbacks::policy_action_cb({:?})", &param);
499+
trace!("Callbacks::policy_action_cb({:?})", param);
500500
Ok(lock.callbacks.policy_action_cb(param))
501501
}
502502
}

tests/12_duplicate_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ fn test_duplicate_key() {
130130
// Enumerate keys
131131
match context.list(crypt_key2) {
132132
Ok(mut list) => {
133-
let duplicated_key = format!("{}/{}", &crypt_key2, child_key2).to_ascii_lowercase();
133+
let duplicated_key = format!("{}/{}", crypt_key2, child_key2).to_ascii_lowercase();
134134
assert!(list.drain(..).any(|entry| entry.to_ascii_lowercase().ends_with(&duplicated_key[..])));
135135
}
136136
Err(error) => panic!("Failed to enumerate the keys: {:?}", error),

tests/15_description_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn test_get_description() {
109109
};
110110

111111
// Verify
112-
debug!("Description: {:?}", &recovered_descr);
112+
debug!("Description: {:?}", recovered_descr);
113113
assert!(recovered_descr.expect("No description avialble!").trim()[..].eq(desciption.trim()))
114114
});
115115
}

tests/common/setup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl<'a> TestConfiguration<'a> {
9999
let temp_path = Path::new(env!("CARGO_TARGET_TMPDIR"));
100100
debug!("Temp directory: \"{}\"", temp_path.to_str().unwrap());
101101

102-
let work_path = temp_path.join(format!("fapi-{}", &RANDOM_UUID_PREFIX));
102+
let work_path = temp_path.join(format!("fapi-{}", RANDOM_UUID_PREFIX));
103103
debug!("Work directory: \"{}\"", work_path.to_str().unwrap());
104104

105105
let conf_file = work_path.join("config.json");

0 commit comments

Comments
 (0)