Skip to content

Commit cb14327

Browse files
committed
Resolve clippy
1 parent bfe2792 commit cb14327

File tree

5 files changed

+17
-23
lines changed

5 files changed

+17
-23
lines changed

crates/bitwarden-core/src/auth/login/access_token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub(crate) async fn login_access_token(
3535
.set_login_method(LoginMethod::ServiceAccount(
3636
ServiceAccountLoginMethod::AccessToken {
3737
access_token,
38-
organization_id: organization_id.into(),
38+
organization_id: organization_id,
3939
state_file: Some(state_file.to_path_buf()),
4040
},
4141
));

crates/bitwarden-core/src/client/encryption_settings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl EncryptionSettings {
9494
#[allow(deprecated)]
9595
store
9696
.context_mut()
97-
.set_symmetric_key(SymmetricKeyId::Organization(organization_id.into()), key)
97+
.set_symmetric_key(SymmetricKeyId::Organization(organization_id), key)
9898
.expect("Mutable context");
9999
}
100100

@@ -122,7 +122,7 @@ impl EncryptionSettings {
122122
for (org_id, org_enc_key) in org_enc_keys {
123123
ctx.decapsulate_key_unsigned(
124124
AsymmetricKeyId::UserPrivateKey,
125-
SymmetricKeyId::Organization(org_id.into()),
125+
SymmetricKeyId::Organization(org_id),
126126
&org_enc_key,
127127
)?;
128128
}

crates/bitwarden-core/src/client/internal.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,20 +223,14 @@ impl InternalClient {
223223
organization_id: OrganizationId,
224224
key: SymmetricCryptoKey,
225225
) {
226-
EncryptionSettings::new_single_org_key(organization_id.into(), key, &self.key_store);
226+
EncryptionSettings::new_single_org_key(organization_id, key, &self.key_store);
227227
}
228228

229229
#[cfg(feature = "internal")]
230230
pub fn initialize_org_crypto(
231231
&self,
232232
org_keys: Vec<(OrganizationId, UnsignedSharedKey)>,
233233
) -> Result<(), EncryptionSettingsError> {
234-
EncryptionSettings::set_org_keys(
235-
org_keys
236-
.into_iter()
237-
.map(|(id, key)| (id.into(), key))
238-
.collect(),
239-
&self.key_store,
240-
)
234+
EncryptionSettings::set_org_keys(org_keys, &self.key_store)
241235
}
242236
}

crates/bitwarden-vault/src/cipher/cipher.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ impl CipherView {
548548
organization_id: OrganizationId,
549549
) -> Result<(), CipherError> {
550550
let old_key = self.key_identifier();
551-
let new_key = SymmetricKeyId::Organization(organization_id.into());
551+
let new_key = SymmetricKeyId::Organization(organization_id);
552552

553553
// If any attachment is missing a key we can't reencrypt the attachment keys
554554
if self.attachments.iter().flatten().any(|a| a.key.is_none()) {
@@ -660,7 +660,7 @@ impl Decryptable<KeyIds, SymmetricKeyId, CipherListView> for Cipher {
660660
impl IdentifyKey<SymmetricKeyId> for Cipher {
661661
fn key_identifier(&self) -> SymmetricKeyId {
662662
match self.organization_id {
663-
Some(organization_id) => SymmetricKeyId::Organization(organization_id.into()),
663+
Some(organization_id) => SymmetricKeyId::Organization(organization_id),
664664
None => SymmetricKeyId::User,
665665
}
666666
}
@@ -669,7 +669,7 @@ impl IdentifyKey<SymmetricKeyId> for Cipher {
669669
impl IdentifyKey<SymmetricKeyId> for CipherView {
670670
fn key_identifier(&self) -> SymmetricKeyId {
671671
match self.organization_id {
672-
Some(organization_id) => SymmetricKeyId::Organization(organization_id.into()),
672+
Some(organization_id) => SymmetricKeyId::Organization(organization_id),
673673
None => SymmetricKeyId::User,
674674
}
675675
}
@@ -678,7 +678,7 @@ impl IdentifyKey<SymmetricKeyId> for CipherView {
678678
impl IdentifyKey<SymmetricKeyId> for CipherListView {
679679
fn key_identifier(&self) -> SymmetricKeyId {
680680
match self.organization_id {
681-
Some(organization_id) => SymmetricKeyId::Organization(organization_id.into()),
681+
Some(organization_id) => SymmetricKeyId::Organization(organization_id),
682682
None => SymmetricKeyId::User,
683683
}
684684
}
@@ -996,7 +996,7 @@ mod tests {
996996
let org = OrganizationId::new_v4();
997997
let key = SymmetricCryptoKey::make_aes256_cbc_hmac_key();
998998
let org_key = SymmetricCryptoKey::make_aes256_cbc_hmac_key();
999-
let key_store = create_test_crypto_with_user_and_org_key(key, org.into(), org_key);
999+
let key_store = create_test_crypto_with_user_and_org_key(key, org, org_key);
10001000

10011001
// Create a cipher with a user key
10021002
let mut cipher = generate_cipher();
@@ -1021,7 +1021,7 @@ mod tests {
10211021
let org = OrganizationId::new_v4();
10221022
let key = SymmetricCryptoKey::make_aes256_cbc_hmac_key();
10231023
let org_key = SymmetricCryptoKey::make_aes256_cbc_hmac_key();
1024-
let key_store = create_test_crypto_with_user_and_org_key(key, org.into(), org_key);
1024+
let key_store = create_test_crypto_with_user_and_org_key(key, org, org_key);
10251025

10261026
// Create a cipher with a user key
10271027
let mut cipher = generate_cipher();
@@ -1041,7 +1041,7 @@ mod tests {
10411041
let org = OrganizationId::new_v4();
10421042
let key = SymmetricCryptoKey::make_aes256_cbc_hmac_key();
10431043
let org_key = SymmetricCryptoKey::make_aes256_cbc_hmac_key();
1044-
let key_store = create_test_crypto_with_user_and_org_key(key, org.into(), org_key);
1044+
let key_store = create_test_crypto_with_user_and_org_key(key, org, org_key);
10451045

10461046
let mut cipher = generate_cipher();
10471047
let attachment = AttachmentView {
@@ -1065,8 +1065,8 @@ mod tests {
10651065
let org = OrganizationId::new_v4();
10661066
let key = SymmetricCryptoKey::make_aes256_cbc_hmac_key();
10671067
let org_key = SymmetricCryptoKey::make_aes256_cbc_hmac_key();
1068-
let key_store = create_test_crypto_with_user_and_org_key(key, org.into(), org_key);
1069-
let org_key = SymmetricKeyId::Organization(org.into());
1068+
let key_store = create_test_crypto_with_user_and_org_key(key, org, org_key);
1069+
let org_key = SymmetricKeyId::Organization(org);
10701070

10711071
// Attachment has a key that is encrypted with the user key, as the cipher has no key itself
10721072
let (attachment_key_enc, attachment_key_val) = {
@@ -1133,8 +1133,8 @@ mod tests {
11331133
let org = OrganizationId::new_v4();
11341134
let key = SymmetricCryptoKey::make_aes256_cbc_hmac_key();
11351135
let org_key = SymmetricCryptoKey::make_aes256_cbc_hmac_key();
1136-
let key_store = create_test_crypto_with_user_and_org_key(key, org.into(), org_key);
1137-
let org_key = SymmetricKeyId::Organization(org.into());
1136+
let key_store = create_test_crypto_with_user_and_org_key(key, org, org_key);
1137+
let org_key = SymmetricKeyId::Organization(org);
11381138

11391139
let mut ctx = key_store.context();
11401140

crates/bitwarden-vault/src/collection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub struct CollectionView {
4848

4949
impl IdentifyKey<SymmetricKeyId> for Collection {
5050
fn key_identifier(&self) -> SymmetricKeyId {
51-
SymmetricKeyId::Organization(self.organization_id.into())
51+
SymmetricKeyId::Organization(self.organization_id)
5252
}
5353
}
5454

0 commit comments

Comments
 (0)