Skip to content

Commit caabbed

Browse files
committed
fix: clippy
1 parent 9c0fc12 commit caabbed

File tree

7 files changed

+13
-18
lines changed

7 files changed

+13
-18
lines changed

vicky/src/bin/vicky/auth.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,13 @@ impl FromStr for Role {
3333
}
3434
}
3535

36-
#[allow(dead_code)]
3736
#[derive(Deserialize)]
3837
pub struct User {
3938
pub id: Uuid,
4039
pub full_name: String,
4140
pub role: Role,
4241
}
4342

44-
pub struct Machine {}
45-
4643
async fn extract_user_from_token(jwks_verifier: &State<RemoteJwksVerifier>, db: &Database, oidc_config: &OIDCConfigResolved, token: &str) -> Result<DbUser, AppError> {
4744
let jwt = jwks_verifier.verify::<Map<String, Value>>(token).await?;
4845

vicky/src/bin/vicky/locks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use uuid::Uuid;
55
use vickylib::database::entities::{Database, Lock};
66
use vickylib::database::entities::lock::db_impl::LockDatabase;
77
use vickylib::database::entities::lock::PoisonedLock;
8-
use crate::auth::{Machine, User};
8+
use crate::auth::{User};
99
use crate::errors::AppError;
1010

1111
async fn locks_get_poisoned(db: &Database) -> Result<Json<Vec<Lock>>, AppError> {

vickyctl/src/account.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use openidconnect::{ErrorResponse, ClientId, IssuerUrl, core::{CoreProviderMetadata, CoreClient, CoreDeviceAuthorizationResponse, CoreAuthDisplay, CoreClientAuthMethod, CoreClaimName, CoreClaimType, CoreGrantType, CoreJweContentEncryptionAlgorithm, CoreJweKeyManagementAlgorithm, CoreJsonWebKey, CoreResponseMode, CoreResponseType, CoreSubjectIdentifierType, CoreJwsSigningAlgorithm, CoreJsonWebKeyType, CoreJsonWebKeyUse}, Scope, reqwest::{http_client}, AdditionalProviderMetadata, ProviderMetadata, DeviceAuthorizationUrl, AuthType, OAuth2TokenResponse};
1+
use openidconnect::{ClientId, IssuerUrl, core::{CoreClient, CoreDeviceAuthorizationResponse, CoreAuthDisplay, CoreClientAuthMethod, CoreClaimName, CoreClaimType, CoreGrantType, CoreJweContentEncryptionAlgorithm, CoreJweKeyManagementAlgorithm, CoreJsonWebKey, CoreResponseMode, CoreResponseType, CoreSubjectIdentifierType, CoreJwsSigningAlgorithm, CoreJsonWebKeyType, CoreJsonWebKeyUse}, Scope, reqwest::{http_client}, AdditionalProviderMetadata, ProviderMetadata, DeviceAuthorizationUrl, AuthType, OAuth2TokenResponse};
22
use serde::{Deserialize, Serialize};
33

4-
use crate::{cli::AppContext, error::Error, FileConfig, AuthState};
4+
use crate::{FileConfig, AuthState};
55

66

77
// Taken from https://github.com/ramosbugs/openidconnect-rs/blob/support/3.x/examples/okta_device_grant.rs
@@ -30,11 +30,11 @@ type DeviceProviderMetadata = ProviderMetadata<
3030

3131

3232
pub fn show(auth_state: &AuthState) -> Result<(), anyhow::Error> {
33-
print!("{:?}", auth_state.clone());
33+
print!("{:?}", auth_state);
3434
Ok(())
3535
}
3636

37-
pub fn login(ctx: &AppContext, vicky_url_str: String, issuer_url_str: String, client_id_str: String) -> Result<(), anyhow::Error> {
37+
pub fn login(vicky_url_str: String, issuer_url_str: String, client_id_str: String) -> Result<(), anyhow::Error> {
3838

3939
let client_id = ClientId::new(client_id_str.clone().to_string());
4040
let issuer_url = IssuerUrl::new(issuer_url_str.clone().to_string())?;

vickyctl/src/http_client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ pub fn prepare_client(auth_state: &AuthState) -> Result<(Client, String), Error>
1111
let auth_token: String = "".to_owned();
1212

1313
match auth_state {
14-
AuthState::EnvironmentAuthenticated(envConfig) => {
15-
base_url = envConfig.url.clone();
14+
AuthState::EnvironmentAuthenticated(env_config) => {
15+
base_url = env_config.url.clone();
1616
},
17-
AuthState::FileAuthenticated(fileCfg) => {
18-
base_url = fileCfg.vicky_url.clone();
17+
AuthState::FileAuthenticated(file_config) => {
18+
base_url = file_config.vicky_url.clone();
1919
},
2020
AuthState::Unauthenticated => {
2121
return Err(Error::Unauthenticated())

vickyctl/src/locks/http.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use reqwest::blocking::Client;
22

3-
use crate::AuthState;
43
use crate::error::Error;
5-
use crate::http_client::prepare_client;
64
use crate::locks::types::{LockType, PoisonedLock};
75

86
pub fn get_locks_endpoint(lock_type: LockType, detailed: bool) -> &'static str {

vickyctl/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ fn main() {
8989
},
9090
Cli::Tasks(tasks_args) => tasks::show_tasks(&tasks_args, &auth_state),
9191
Cli::Locks(locks_args) => tui::show_locks(&locks_args, &auth_state),
92-
Cli::Resolve(resolve_args) => tui::resolve_lock(&resolve_args, &auth_state),
92+
Cli::Resolve(_) => tui::resolve_lock(&auth_state),
9393

9494
Cli::Account(account_args) => match account_args.commands {
9595
AccountCommands::Show => show(&auth_state).map_err(crate::error::Error::from),
96-
AccountCommands::Login{ vicky_url, client_id, issuer_url} => login(&account_args.ctx, vicky_url, issuer_url, client_id).map_err(crate::error::Error::from)
96+
AccountCommands::Login{ vicky_url, client_id, issuer_url} => login( vicky_url, issuer_url, client_id).map_err(crate::error::Error::from)
9797
}
9898

9999
};

vickyctl/src/tui/lock_resolver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::cli::{LocksArgs, ResolveArgs};
1+
use crate::cli::{LocksArgs};
22
use crate::error::Error;
33
use crate::http_client::prepare_client;
44
use crate::{humanize, AuthState};
@@ -44,7 +44,7 @@ pub fn show_locks(locks_args: &LocksArgs, auth_state: &AuthState) -> Result<(),
4444
Ok(())
4545
}
4646

47-
pub fn resolve_lock(resolve_args: &ResolveArgs, auth_state: &AuthState) -> Result<(), Error> {
47+
pub fn resolve_lock(auth_state: &AuthState) -> Result<(), Error> {
4848
let (client, vicky_url) = prepare_client(auth_state)?;
4949

5050
let mut locks = fetch_detailed_poisoned_locks(&client, vicky_url.clone())?;

0 commit comments

Comments
 (0)