Skip to content

Commit a89b588

Browse files
authored
Fix clippy CI (#84)
## 🎟️ Tracking <!-- Paste the link to the Jira or GitHub issue or otherwise describe / point to where this change is coming from. --> ## 📔 Objective <!-- Describe what the purpose of this PR is, for example what bug you're fixing or new feature you're adding. --> ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
1 parent 9f6a864 commit a89b588

File tree

14 files changed

+35
-28
lines changed

14 files changed

+35
-28
lines changed

.github/workflows/lint.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Install clippy-sarif and sarif-fmt
3939
run: cargo install clippy-sarif sarif-fmt --locked --git https://github.com/psastras/sarif-rs.git --rev 11c33a53f6ffeaed736856b86fb6b7b09fabdfd8
4040

41-
- name: Cargo clippy
41+
- name: Cargo clippy-sarif
4242
run: cargo clippy --all-features --tests --message-format=json |
4343
clippy-sarif | tee clippy_result.sarif | sarif-fmt
4444
env:
@@ -49,6 +49,14 @@ jobs:
4949
with:
5050
sarif_file: clippy_result.sarif
5151

52+
# Run it again but this time without the sarif output so that the
53+
# status code of the command is caught and reported as failed in GitHub.
54+
# This should be cached from the previous step and should be fast.
55+
- name: Cargo clippy
56+
run: cargo clippy --all-features --tests
57+
env:
58+
RUSTFLAGS: "-D warnings"
59+
5260
- name: Install cargo-sort
5361
run: cargo install cargo-sort --locked --git https://github.com/DevinR528/cargo-sort.git --rev f5047967021cbb1f822faddc355b3b07674305a1
5462

crates/bitwarden-core/src/util.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const INDIFFERENT: GeneralPurposeConfig =
99
pub const STANDARD_INDIFFERENT: GeneralPurpose =
1010
GeneralPurpose::new(&alphabet::STANDARD, INDIFFERENT);
1111

12+
#[allow(dead_code)]
1213
#[cfg(test)]
1314
pub async fn start_mock(mocks: Vec<wiremock::Mock>) -> (wiremock::MockServer, crate::Client) {
1415
let server = wiremock::MockServer::start().await;

crates/bitwarden-error-macro/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mod full;
99
/// # Attributes
1010
///
1111
/// ## Error type
12-
12+
///
1313
/// - `basic`: The error is converted into a string using the `ToString` trait.
1414
/// - `flat`: The error is converted into a flat structure using the `FlatError` trait.
1515
/// - `full`: The entire error stack is made available using `serde`.

crates/bitwarden-fido/src/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ pub enum Origin {
390390
Android(UnverifiedAssetLink),
391391
}
392392

393-
impl<'a> TryFrom<Origin> for passkey::client::Origin<'a> {
393+
impl TryFrom<Origin> for passkey::client::Origin<'_> {
394394
type Error = InvalidOriginError;
395395

396396
fn try_from(value: Origin) -> Result<Self, Self::Error> {
@@ -404,7 +404,7 @@ impl<'a> TryFrom<Origin> for passkey::client::Origin<'a> {
404404
}
405405
}
406406

407-
impl<'a> TryFrom<UnverifiedAssetLink> for passkey::client::UnverifiedAssetLink<'a> {
407+
impl TryFrom<UnverifiedAssetLink> for passkey::client::UnverifiedAssetLink<'_> {
408408
type Error = InvalidOriginError;
409409

410410
fn try_from(value: UnverifiedAssetLink) -> Result<Self, Self::Error> {

crates/bitwarden-uniffi/src/error.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ pub enum Error {
4848

4949
// Generators
5050
#[error(transparent)]
51-
UsernameError(#[from] UsernameError),
51+
Username(#[from] UsernameError),
5252
#[error(transparent)]
53-
PassphraseError(#[from] PassphraseError),
53+
Passphrase(#[from] PassphraseError),
5454
#[error(transparent)]
55-
PasswordError(#[from] PasswordError),
55+
Password(#[from] PasswordError),
5656

5757
// Vault
5858
#[error(transparent)]
@@ -61,7 +61,7 @@ pub enum Error {
6161
Totp(#[from] bitwarden_vault::TotpError),
6262

6363
#[error(transparent)]
64-
ExportError(#[from] ExportError),
64+
Export(#[from] ExportError),
6565

6666
// Fido
6767
#[error(transparent)]
@@ -71,11 +71,9 @@ pub enum Error {
7171
#[error(transparent)]
7272
SilentlyDiscoverCredentials(#[from] bitwarden_fido::SilentlyDiscoverCredentialsError),
7373
#[error(transparent)]
74-
CredentialsForAutofillError(#[from] bitwarden_fido::CredentialsForAutofillError),
74+
CredentialsForAutofill(#[from] bitwarden_fido::CredentialsForAutofillError),
7575
#[error(transparent)]
76-
DecryptFido2AutofillCredentialsError(
77-
#[from] bitwarden_fido::DecryptFido2AutofillCredentialsError,
78-
),
76+
DecryptFido2AutofillCredentials(#[from] bitwarden_fido::DecryptFido2AutofillCredentialsError),
7977
#[error(transparent)]
8078
Fido2Client(#[from] bitwarden_fido::Fido2ClientError),
8179
}

crates/bitwarden-uniffi/src/platform/fido2.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl ClientFido2 {
5252
.0
5353
.fido2()
5454
.decrypt_fido2_autofill_credentials(cipher_view)
55-
.map_err(Error::DecryptFido2AutofillCredentialsError)?;
55+
.map_err(Error::DecryptFido2AutofillCredentials)?;
5656

5757
Ok(result)
5858
}
@@ -122,7 +122,7 @@ impl ClientFido2Authenticator {
122122
let result = auth
123123
.credentials_for_autofill()
124124
.await
125-
.map_err(Error::CredentialsForAutofillError)?;
125+
.map_err(Error::CredentialsForAutofill)?;
126126
Ok(result)
127127
}
128128
}

crates/bitwarden-uniffi/src/tool/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl ClientGenerators {
2727
.0
2828
.generator()
2929
.password(settings)
30-
.map_err(Error::PasswordError)?)
30+
.map_err(Error::Password)?)
3131
}
3232

3333
/// Generate Passphrase
@@ -37,7 +37,7 @@ impl ClientGenerators {
3737
.0
3838
.generator()
3939
.passphrase(settings)
40-
.map_err(Error::PassphraseError)?)
40+
.map_err(Error::Passphrase)?)
4141
}
4242

4343
/// Generate Username
@@ -48,7 +48,7 @@ impl ClientGenerators {
4848
.generator()
4949
.username(settings)
5050
.await
51-
.map_err(Error::UsernameError)?)
51+
.map_err(Error::Username)?)
5252
}
5353
}
5454

@@ -69,7 +69,7 @@ impl ClientExporters {
6969
.0
7070
.exporters()
7171
.export_vault(folders, ciphers, format)
72-
.map_err(Error::ExportError)?)
72+
.map_err(Error::Export)?)
7373
}
7474

7575
/// Export organization vault
@@ -84,7 +84,7 @@ impl ClientExporters {
8484
.0
8585
.exporters()
8686
.export_organization_vault(collections, ciphers, format)
87-
.map_err(Error::ExportError)?)
87+
.map_err(Error::Export)?)
8888
}
8989

9090
/// Credential Exchange Format (CXF)
@@ -99,7 +99,7 @@ impl ClientExporters {
9999
.0
100100
.exporters()
101101
.export_cxf(account, ciphers)
102-
.map_err(Error::ExportError)?)
102+
.map_err(Error::Export)?)
103103
}
104104

105105
/// Credential Exchange Format (CXF)
@@ -114,6 +114,6 @@ impl ClientExporters {
114114
.0
115115
.exporters()
116116
.import_cxf(payload)
117-
.map_err(Error::ExportError)?)
117+
.map_err(Error::Export)?)
118118
}
119119
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub struct AttachmentFileView<'a> {
5757
pub contents: &'a [u8],
5858
}
5959

60-
impl<'a> KeyEncryptable<SymmetricCryptoKey, AttachmentEncryptResult> for AttachmentFileView<'a> {
60+
impl KeyEncryptable<SymmetricCryptoKey, AttachmentEncryptResult> for AttachmentFileView<'_> {
6161
fn encrypt_with_key(
6262
self,
6363
key: &SymmetricCryptoKey,

crates/bitwarden-vault/src/mobile/client_attachments.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub struct ClientAttachments<'a> {
1212
pub(crate) client: &'a Client,
1313
}
1414

15-
impl<'a> ClientAttachments<'a> {
15+
impl ClientAttachments<'_> {
1616
pub fn encrypt_buffer(
1717
&self,
1818
cipher: Cipher,

crates/bitwarden-vault/src/mobile/client_ciphers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub struct ClientCiphers<'a> {
88
pub(crate) client: &'a Client,
99
}
1010

11-
impl<'a> ClientCiphers<'a> {
11+
impl ClientCiphers<'_> {
1212
pub fn encrypt(&self, mut cipher_view: CipherView) -> Result<Cipher, Error> {
1313
let enc = self.client.internal.get_encryption_settings()?;
1414

crates/bitwarden-vault/src/mobile/client_collection.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub struct ClientCollections<'a> {
77
pub(crate) client: &'a Client,
88
}
99

10-
impl<'a> ClientCollections<'a> {
10+
impl ClientCollections<'_> {
1111
pub fn decrypt(&self, collection: Collection) -> Result<CollectionView, Error> {
1212
let enc = self.client.internal.get_encryption_settings()?;
1313
let key = collection.locate_key(&enc, &None)?;

crates/bitwarden-vault/src/mobile/client_folders.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub struct ClientFolders<'a> {
77
pub(crate) client: &'a Client,
88
}
99

10-
impl<'a> ClientFolders<'a> {
10+
impl ClientFolders<'_> {
1111
pub fn encrypt(&self, folder_view: FolderView) -> Result<Folder, Error> {
1212
let enc = self.client.internal.get_encryption_settings()?;
1313
let key = enc.get_key(&None)?;

crates/bitwarden-vault/src/mobile/client_password_history.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub struct ClientPasswordHistory<'a> {
77
pub(crate) client: &'a Client,
88
}
99

10-
impl<'a> ClientPasswordHistory<'a> {
10+
impl ClientPasswordHistory<'_> {
1111
pub fn encrypt(&self, history_view: PasswordHistoryView) -> Result<PasswordHistory, Error> {
1212
let enc = self.client.internal.get_encryption_settings()?;
1313
let key = enc.get_key(&None)?;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl BitwardenClient {
5454
env!("SDK_VERSION").to_owned()
5555
}
5656

57-
pub async fn throw(&self, msg: String) -> Result<(), TestError> {
57+
pub fn throw(&self, msg: String) -> Result<(), TestError> {
5858
Err(TestError(msg))
5959
}
6060

0 commit comments

Comments
 (0)