Skip to content

Commit

Permalink
credential-provider: Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Sep 16, 2024
1 parent 6f1c7a4 commit 7fa8ba4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cargo-credential/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl SecretServiceCredential {

match action {
cargo_credential::Action::Get(_) => {
if items.len() == 0 {
if items.is_empty() {
return Err(Error::NotFound);
}

Expand All @@ -49,12 +49,11 @@ impl SecretServiceCredential {
cargo_credential::Action::Login(options) => {
let token = cargo_credential::read_token(options, registry)?.expose();

if let Some(item) = items.get(0) {
if let Some(item) = items.first() {
item.set_secret(token, "text/utf8")
.await
.map_err(|err| Error::Other(Box::new(err)))?;
.await
.map_err(|err| Error::Other(Box::new(err)))?;
} else {

collection
.create_item(
&format!("cargo-registry:{}", registry.index_url),
Expand All @@ -70,7 +69,7 @@ impl SecretServiceCredential {
Ok(CredentialResponse::Login)
}
cargo_credential::Action::Logout => {
if items.len() == 0 {
if items.is_empty() {
return Err(Error::NotFound);
}

Expand Down

0 comments on commit 7fa8ba4

Please sign in to comment.