Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
deepu105 committed Aug 19, 2024
1 parent f5bbcf0 commit 8ea7da5
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 38 deletions.
16 changes: 12 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/app/contexts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct KubeContext {
pub name: String,
pub cluster: String,
pub user: String,
pub namespace: Option<String>,
// pub namespace: Option<String>,
pub is_active: bool,
}

Expand All @@ -35,7 +35,7 @@ impl KubeContext {
name: ctx.name.clone(),
cluster: context.cluster.clone(),
user: context.user.clone(),
namespace: context.namespace.clone(),
// namespace: context.namespace.clone(),
is_active,
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/app/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ use crate::{

#[derive(Clone, Debug)]
pub struct KubeDynamicKind {
pub name: String,
pub group: String,
pub version: String,
pub api_version: String,
// pub name: String,
// pub group: String,
// pub version: String,
// pub api_version: String,
pub kind: String,
pub scope: Scope,
pub api_resource: ApiResource,
Expand All @@ -41,10 +41,10 @@ impl KubeDynamicKind {
pub fn new(ar: ApiResource, scope: Scope) -> Self {
KubeDynamicKind {
api_resource: ar.clone(),
name: ar.plural,
group: ar.group,
version: ar.version,
api_version: ar.api_version,
// name: ar.plural,
// group: ar.group,
// version: ar.version,
// api_version: ar.api_version,
kind: ar.kind,
scope,
}
Expand Down
5 changes: 1 addition & 4 deletions src/app/ingress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ impl From<Ingress> for KubeIngress {
Some(n) => n.clone(),
None => UNKNOWN.into(),
};
let paths = match rules {
Some(r) => r,
None => String::default(),
};
let paths = rules.unwrap_or_default();
Self {
name,
namespace,
Expand Down
17 changes: 8 additions & 9 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ pub struct App {
pub tick_until_poll: u64,
pub tick_count: u64,
pub enhanced_graphics: bool,
pub table_cols: u16,
// pub table_cols: u16,
// pub dialog: Option<String>,
// pub confirm: bool,
pub size: Rect,
pub api_error: String,
pub dialog: Option<String>,
pub app_input: AppInput,
pub confirm: bool,
pub light_theme: bool,
pub refresh: bool,
pub log_auto_scroll: bool,
Expand Down Expand Up @@ -422,15 +422,15 @@ impl Default for App {
tick_until_poll: 0,
tick_count: 0,
enhanced_graphics: false,
table_cols: 0,
// table_cols: 0,
// dialog: None,
// confirm: false,
size: Rect::default(),
api_error: String::new(),
dialog: None,
app_input: AppInput {
input: Input::default(),
input_mode: InputMode::Normal,
},
confirm: false,
light_theme: false,
refresh: true,
log_auto_scroll: true,
Expand Down Expand Up @@ -755,10 +755,9 @@ mod test_utils {

use super::models::KubeResource;

pub fn convert_resource_from_file<K: Serialize, T>(filename: &str) -> (Vec<T>, Vec<K>)
pub fn convert_resource_from_file<K, T>(filename: &str) -> (Vec<T>, Vec<K>)
where
K: Clone + DeserializeOwned + fmt::Debug,
K: Resource,
K: Serialize + Resource + Clone + DeserializeOwned + fmt::Debug,
T: KubeResource<K> + From<K>,
{
let res_list = load_resource_from_file(filename);
Expand Down
5 changes: 0 additions & 5 deletions src/event/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@ use std::{

use crossterm::event::{self, Event as CEvent, KeyEvent, MouseEvent};

use super::Key;

#[derive(Debug, Clone, Copy)]
/// Configuration for event handling.
pub struct EventConfig {
pub exit_key: Key,
/// The tick rate at which the application will sent an tick event.
pub tick_rate: Duration,
}

impl Default for EventConfig {
fn default() -> EventConfig {
EventConfig {
exit_key: Key::Ctrl('c'),
tick_rate: Duration::from_millis(250),
}
}
Expand Down Expand Up @@ -48,7 +44,6 @@ impl Events {
pub fn new(tick_rate: u64) -> Events {
Events::with_config(EventConfig {
tick_rate: Duration::from_millis(tick_rate),
..EventConfig::default()
})
}

Expand Down
3 changes: 2 additions & 1 deletion src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,10 @@ async fn handle_block_scroll(app: &mut App, up: bool, is_mouse: bool, page: bool
}

fn copy_to_clipboard(content: String, app: &mut App) {
use std::thread;

use anyhow::anyhow;
use copypasta::{ClipboardContext, ClipboardProvider};
use std::thread;

match ClipboardContext::new() {
Ok(mut ctx) => match ctx.set_contents(content) {
Expand Down
10 changes: 5 additions & 5 deletions src/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ impl<'a> Network<'a> {
}

/// calls the kubernetes API to list the given resource for either selected namespace or all namespaces
pub async fn get_namespaced_resources<K: ApiResource, T, F>(&self, map_fn: F) -> Vec<T>
pub async fn get_namespaced_resources<K, T, F>(&self, map_fn: F) -> Vec<T>
where
<K as ApiResource>::DynamicType: Default,
K: kube::Resource<Scope = NamespaceResourceScope>,
Expand All @@ -294,10 +294,10 @@ impl<'a> Network<'a> {
}

/// calls the kubernetes API to list the given resource for all namespaces
pub async fn get_resources<K: ApiResource, T, F>(&self, map_fn: F) -> Vec<T>
pub async fn get_resources<K, T, F>(&self, map_fn: F) -> Vec<T>
where
<K as ApiResource>::DynamicType: Default,
K: Clone + DeserializeOwned + fmt::Debug,
K: ApiResource + Clone + DeserializeOwned + fmt::Debug,
F: Fn(K) -> T,
{
let api: Api<K> = Api::all(self.client.clone());
Expand All @@ -317,10 +317,10 @@ impl<'a> Network<'a> {
}
}

pub async fn get_namespaced_api<K: ApiResource>(&self) -> Api<K>
pub async fn get_namespaced_api<K>(&self) -> Api<K>
where
<K as ApiResource>::DynamicType: Default,
K: kube::Resource<Scope = NamespaceResourceScope>,
K: ApiResource + kube::Resource<Scope = NamespaceResourceScope>,
{
let app = self.app.lock().await;
match &app.data.selected.ns {
Expand Down

0 comments on commit 8ea7da5

Please sign in to comment.