Skip to content

Commit 89c5557

Browse files
Run clippy on tests as well
1 parent 35dd1c9 commit 89c5557

8 files changed

Lines changed: 19 additions & 16 deletions

File tree

.github/workflows/CI.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ jobs:
9494
with:
9595
components: clippy
9696
- name: Clippy workspace (default features)
97-
run: cargo clippy --workspace -- -D warnings
97+
run: cargo clippy --workspace --tests -- -D warnings
9898
- name: Clippy client (tracing / async-std / native crypto)
9999
run: cargo clippy -p oo7 --no-default-features --features tracing,async-std,native_crypto,schema -- -D warnings
100100
- name: Clippy client (tracing / tokio / OpenSSL)
101-
run: cargo clippy -p oo7 --no-default-features --features tracing,tokio,openssl_crypto,schema -- -D warnings
101+
run: cargo clippy -p oo7 --no-default-features --features tracing,tokio,openssl_crypto,schema --tests -- -D warnings
102102

103103
meson:
104104
name: Meson

client/tests/file_unlocked_keyring.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ async fn comprehensive_search_patterns() -> Result<(), Error> {
410410
let keyring = UnlockedKeyring::load(&keyring_path, strong_key()).await?;
411411

412412
// Create diverse test data
413-
let test_items = vec![
413+
let test_items = [
414414
(
415415
"Email Password",
416416
vec![
@@ -596,7 +596,7 @@ async fn secret_types_handling() -> Result<(), Error> {
596596
.create_item(
597597
"Binary Secret",
598598
&[("type", "binary")],
599-
Secret::blob(&[0x00, 0x01, 0x02, 0xFF]),
599+
Secret::blob([0x00, 0x01, 0x02, 0xFF]),
600600
false,
601601
)
602602
.await?;

server/src/collection/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ async fn delete_locked_collection_with_prompt_impl(
574574
setup.server.set_prompter_type(prompter_type).await;
575575
let default_collection = setup.default_collection().await?;
576576

577-
setup.lock_collection(&default_collection).await?;
577+
setup.lock_collection(default_collection).await?;
578578

579579
assert!(
580580
default_collection.is_locked().await?,
@@ -636,7 +636,7 @@ async fn unlock_retry_impl(prompter_type: PrompterType) -> Result<(), Box<dyn st
636636
.create_item("Test Item", &[("app", "test")], &dbus_secret, false, None)
637637
.await?;
638638

639-
setup.lock_collection(&default_collection).await?;
639+
setup.lock_collection(default_collection).await?;
640640

641641
assert!(
642642
default_collection.is_locked().await?,

server/src/gnome/internal.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ mod tests {
311311
// Lock the collection
312312
setup
313313
.service_api
314-
.lock(&[collection_path.clone()], None)
314+
.lock(std::slice::from_ref(&collection_path), None)
315315
.await?;
316316

317317
// Verify it's locked
@@ -369,7 +369,7 @@ mod tests {
369369
// Verify the password was changed by locking and unlocking with new password
370370
setup
371371
.service_api
372-
.lock(&[collection_path.clone()], None)
372+
.lock(std::slice::from_ref(&collection_path), None)
373373
.await?;
374374
assert!(
375375
default_collection.is_locked().await?,
@@ -429,7 +429,7 @@ mod tests {
429429
// Verify the password was changed by locking and unlocking with new password
430430
setup
431431
.service_api
432-
.lock(&[collection_path.clone()], None)
432+
.lock(std::slice::from_ref(&collection_path), None)
433433
.await?;
434434
assert!(
435435
default_collection.is_locked().await?,
@@ -474,7 +474,7 @@ mod tests {
474474
// Lock the collection
475475
setup
476476
.service_api
477-
.lock(&[collection_path.clone()], None)
477+
.lock(std::slice::from_ref(&collection_path), None)
478478
.await?;
479479

480480
// Verify it's locked before attempting unlock

server/src/item/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ async fn delete_locked_item_with_prompt_impl(
417417
let items = default_collection.items().await?;
418418
assert_eq!(items.len(), 1, "Should have one item");
419419

420-
setup.lock_collection(&default_collection).await?;
420+
setup.lock_collection(default_collection).await?;
421421

422422
assert!(item.is_locked().await?, "Item should be locked");
423423

server/src/service/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl Service {
111111
{
112112
// For p2p test connections, use a dummy sender since p2p connections
113113
// don't have a bus to assign unique names
114-
UniqueName::try_from(":p2p.test").unwrap().into()
114+
UniqueName::try_from(":p2p.test").unwrap()
115115
}
116116
#[cfg(not(any(test, feature = "test-util")))]
117117
{

server/src/service/tests.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ async fn get_secrets() -> Result<(), Box<dyn std::error::Error>> {
106106
let setup = TestServiceSetup::plain_session(true).await?;
107107

108108
// Test with empty items list - edge case
109-
let secrets = setup.service_api.secrets(&vec![], &setup.session).await?;
109+
#[allow(clippy::mutable_key_type)]
110+
let secrets = setup.service_api.secrets(&[], &setup.session).await?;
110111
assert!(
111112
secrets.is_empty(),
112113
"Should return empty secrets for empty items list"
@@ -125,6 +126,7 @@ async fn get_secrets() -> Result<(), Box<dyn std::error::Error>> {
125126

126127
// Get secrets for both items
127128
let item_paths = vec![item1.clone(), item2.clone()];
129+
#[allow(clippy::mutable_key_type)]
128130
let secrets = setup
129131
.service_api
130132
.secrets(&item_paths, &setup.session)
@@ -178,6 +180,7 @@ async fn get_secrets_multiple_collections() -> Result<(), Box<dyn std::error::Er
178180

179181
// Get secrets for both items from different collections
180182
let item_paths = vec![item1.clone(), item2.clone()];
183+
#[allow(clippy::mutable_key_type)]
181184
let secrets = setup
182185
.service_api
183186
.secrets(&item_paths, &setup.session)
@@ -399,6 +402,7 @@ async fn get_secrets_with_non_existent_items() -> Result<(), Box<dyn std::error:
399402

400403
// Request secrets for both real and fake items
401404
let item_paths = vec![item1.clone(), fake_item];
405+
#[allow(clippy::mutable_key_type)]
402406
let secrets = setup
403407
.service_api
404408
.secrets(&item_paths, &setup.session)

server/src/tests.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ impl TestServiceSetup {
186186
let session = Arc::new(session);
187187

188188
let aes_key =
189-
oo7::Key::generate_aes_key(&client_private_key, &server_public_key.as_ref().unwrap())?;
189+
oo7::Key::generate_aes_key(&client_private_key, server_public_key.as_ref().unwrap())?;
190190

191191
let collections = service_api.collections().await?;
192192

@@ -645,7 +645,6 @@ pub(crate) struct MockPrompterServicePlasma {
645645
}
646646

647647
#[cfg(any(feature = "plasma_native_crypto", feature = "plasma_openssl_crypto"))]
648-
649648
impl MockPrompterServicePlasma {
650649
pub fn new() -> Self {
651650
Self {
@@ -734,7 +733,7 @@ impl MockPrompterServicePlasma {
734733
let connection = connection.clone();
735734

736735
// Reject case
737-
if *self.should_accept.lock().await == false {
736+
if !*self.should_accept.lock().await {
738737
tokio::spawn(async move {
739738
tracing::debug!(
740739
"MockPrompterServicePlasma: dismissing prompt for {}",

0 commit comments

Comments
 (0)