Skip to content

Commit 9735ad4

Browse files
committed
feat(cli): clippy
1 parent bbab41b commit 9735ad4

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

libs/cli/src/cli_config/cli_cluster_config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ pub struct CliClusterConfig {
55
pub token_exist: bool,
66
}
77

8+
impl Default for CliClusterConfig {
9+
fn default() -> Self {
10+
CliClusterConfig::new()
11+
}
12+
}
13+
814
impl CliClusterConfig {
915
pub fn new() -> Self {
1016
CliClusterConfig { token_exist: true }

libs/cli/src/cli_config/cli_server_config.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@ impl CliServerConfig {
9797
}
9898

9999
pub fn get_base_configuration(&self) -> Result<Configuration, ProxyAuthK8sError> {
100-
let token = match self.get_server_token() {
101-
Ok(t) => t,
102-
Err(err) => return Err(err),
103-
};
100+
let token = self.get_server_token()?;
104101
Ok(Configuration {
105102
base_path: self.url.clone(),
106103
bearer_access_token: Some(token),

libs/cli/src/error.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use core::error;
2-
31
use client_api::apis::api_clusters_api::GetAllVisibleClusterError;
42
use thiserror::Error;
53

@@ -53,11 +51,11 @@ impl From<CliConfigError> for ProxyAuthK8sError {
5351
impl From<GetAllVisibleClusterError> for ProxyAuthK8sError {
5452
fn from(value: GetAllVisibleClusterError) -> Self {
5553
match value {
56-
GetAllVisibleClusterError::Status401() => ProxyAuthK8sError::Unauthenticated(format!(
57-
"Authentification failed, please re-login to the server."
58-
)),
54+
GetAllVisibleClusterError::Status401() => ProxyAuthK8sError::Unauthenticated(
55+
"Authentification failed, please re-login to the server.".to_owned(),
56+
),
5957
GetAllVisibleClusterError::Status500() => ProxyAuthK8sError::RemoteServerError(
60-
format!("Invalid response from server, see debug to have more details",),
58+
"Invalid response from server, see debug to have more details".to_owned(),
6159
),
6260
GetAllVisibleClusterError::UnknownValue(val) => {
6361
ProxyAuthK8sError::RemoteServerError(format!("Unknown error from server: {}", val))

0 commit comments

Comments
 (0)