chore: Rust 1.80 linting
This commit is contained in:
@@ -201,7 +201,7 @@ impl DockerData {
|
|||||||
/// Get all current containers, handle into ContainerItem in the app_data struct rather than here
|
/// Get all current containers, handle into ContainerItem in the app_data struct rather than here
|
||||||
/// Just make sure that items sent are guaranteed to have an id
|
/// Just make sure that items sent are guaranteed to have an id
|
||||||
/// If in a containerised runtime, will ignore any container that uses the `/app/oxker` as an entry point, unless the `-s` flag is set
|
/// If in a containerised runtime, will ignore any container that uses the `/app/oxker` as an entry point, unless the `-s` flag is set
|
||||||
pub async fn update_all_containers(&mut self) -> Vec<(State, ContainerId)> {
|
pub async fn update_all_containers(&self) -> Vec<(State, ContainerId)> {
|
||||||
let containers = self
|
let containers = self
|
||||||
.docker
|
.docker
|
||||||
.list_containers(Some(ListContainersOptions::<String> {
|
.list_containers(Some(ListContainersOptions::<String> {
|
||||||
@@ -271,7 +271,7 @@ impl DockerData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Update all logs, spawn each container into own tokio::spawn thread
|
/// Update all logs, spawn each container into own tokio::spawn thread
|
||||||
fn init_all_logs(&mut self, all_ids: &[(State, ContainerId)]) {
|
fn init_all_logs(&self, all_ids: &[(State, ContainerId)]) {
|
||||||
for (_, id) in all_ids {
|
for (_, id) in all_ids {
|
||||||
let docker = Arc::clone(&self.docker);
|
let docker = Arc::clone(&self.docker);
|
||||||
let app_data = Arc::clone(&self.app_data);
|
let app_data = Arc::clone(&self.app_data);
|
||||||
|
|||||||
+13
-13
@@ -178,7 +178,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Save the currently selected containers logs into a `[container_name]_[timestamp].log` file
|
/// Save the currently selected containers logs into a `[container_name]_[timestamp].log` file
|
||||||
async fn s_key(&mut self) {
|
async fn s_key(&self) {
|
||||||
/// This is the inner workings, *inlined* here to return a Result
|
/// This is the inner workings, *inlined* here to return a Result
|
||||||
async fn save_logs(
|
async fn save_logs(
|
||||||
app_data: &Arc<Mutex<AppData>>,
|
app_data: &Arc<Mutex<AppData>>,
|
||||||
@@ -266,7 +266,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Send docker command, if the Commands panel is selected
|
/// Send docker command, if the Commands panel is selected
|
||||||
async fn enter_key(&mut self) {
|
async fn enter_key(&self) {
|
||||||
// This isn't great, just means you can't send docker commands before full initialization of the program
|
// This isn't great, just means you can't send docker commands before full initialization of the program
|
||||||
let panel = self.gui_state.lock().get_selected_panel();
|
let panel = self.gui_state.lock().get_selected_panel();
|
||||||
if panel == SelectablePanel::Commands {
|
if panel == SelectablePanel::Commands {
|
||||||
@@ -307,7 +307,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Change the the "next" selectable panel
|
/// Change the the "next" selectable panel
|
||||||
fn tab_key(&mut self) {
|
fn tab_key(&self) {
|
||||||
let is_containers =
|
let is_containers =
|
||||||
self.gui_state.lock().get_selected_panel() == SelectablePanel::Containers;
|
self.gui_state.lock().get_selected_panel() == SelectablePanel::Containers;
|
||||||
let count = if self.app_data.lock().get_container_len() == 0 && is_containers {
|
let count = if self.app_data.lock().get_container_len() == 0 && is_containers {
|
||||||
@@ -321,7 +321,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Change to previously selected panel
|
/// Change to previously selected panel
|
||||||
fn back_tab_key(&mut self) {
|
fn back_tab_key(&self) {
|
||||||
let is_containers = self.gui_state.lock().get_selected_panel() == SelectablePanel::Logs;
|
let is_containers = self.gui_state.lock().get_selected_panel() == SelectablePanel::Logs;
|
||||||
let count = if self.app_data.lock().get_container_len() == 0 && is_containers {
|
let count = if self.app_data.lock().get_container_len() == 0 && is_containers {
|
||||||
2
|
2
|
||||||
@@ -333,7 +333,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn home_key(&mut self) {
|
fn home_key(&self) {
|
||||||
let mut locked_data = self.app_data.lock();
|
let mut locked_data = self.app_data.lock();
|
||||||
let selected_panel = self.gui_state.lock().get_selected_panel();
|
let selected_panel = self.gui_state.lock().get_selected_panel();
|
||||||
match selected_panel {
|
match selected_panel {
|
||||||
@@ -344,7 +344,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Go to end of the list of the currently selected panel
|
/// Go to end of the list of the currently selected panel
|
||||||
fn end_key(&mut self) {
|
fn end_key(&self) {
|
||||||
let mut locked_data = self.app_data.lock();
|
let mut locked_data = self.app_data.lock();
|
||||||
let selected_panel = self.gui_state.lock().get_selected_panel();
|
let selected_panel = self.gui_state.lock().get_selected_panel();
|
||||||
match selected_panel {
|
match selected_panel {
|
||||||
@@ -366,7 +366,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Actions to take when Error status active
|
/// Actions to take when Error status active
|
||||||
fn handle_error(&mut self, key_code: KeyCode) {
|
fn handle_error(&self, key_code: KeyCode) {
|
||||||
match key_code {
|
match key_code {
|
||||||
KeyCode::Esc | KeyCode::Char('c' | 'C') => {
|
KeyCode::Esc | KeyCode::Char('c' | 'C') => {
|
||||||
self.app_data.lock().remove_error();
|
self.app_data.lock().remove_error();
|
||||||
@@ -377,7 +377,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Actions to take when Delete status active
|
/// Actions to take when Delete status active
|
||||||
async fn handle_delete(&mut self, key_code: KeyCode) {
|
async fn handle_delete(&self, key_code: KeyCode) {
|
||||||
match key_code {
|
match key_code {
|
||||||
KeyCode::Char('y' | 'Y') => self.confirm_delete().await,
|
KeyCode::Char('y' | 'Y') => self.confirm_delete().await,
|
||||||
KeyCode::Esc | KeyCode::Char('n' | 'N') => self.clear_delete(),
|
KeyCode::Esc | KeyCode::Char('n' | 'N') => self.clear_delete(),
|
||||||
@@ -386,7 +386,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Actions to take when Filter status active
|
/// Actions to take when Filter status active
|
||||||
fn handle_filter(&mut self, key_code: KeyCode) {
|
fn handle_filter(&self, key_code: KeyCode) {
|
||||||
match key_code {
|
match key_code {
|
||||||
KeyCode::Esc => {
|
KeyCode::Esc => {
|
||||||
self.app_data.lock().filter_term_clear();
|
self.app_data.lock().filter_term_clear();
|
||||||
@@ -489,7 +489,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check if a button press interacts with either the yes or no buttons in the delete container confirm window
|
/// Check if a button press interacts with either the yes or no buttons in the delete container confirm window
|
||||||
async fn button_intersect(&mut self, mouse_event: MouseEvent) {
|
async fn button_intersect(&self, mouse_event: MouseEvent) {
|
||||||
if mouse_event.kind == MouseEventKind::Down(MouseButton::Left) {
|
if mouse_event.kind == MouseEventKind::Down(MouseButton::Left) {
|
||||||
let intersect = self.gui_state.lock().button_intersect(Rect::new(
|
let intersect = self.gui_state.lock().button_intersect(Rect::new(
|
||||||
mouse_event.column,
|
mouse_event.column,
|
||||||
@@ -508,7 +508,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Handle mouse button events
|
/// Handle mouse button events
|
||||||
fn mouse_press(&mut self, mouse_event: MouseEvent) {
|
fn mouse_press(&self, mouse_event: MouseEvent) {
|
||||||
match mouse_event.kind {
|
match mouse_event.kind {
|
||||||
MouseEventKind::ScrollUp => self.previous(),
|
MouseEventKind::ScrollUp => self.previous(),
|
||||||
MouseEventKind::ScrollDown => self.next(),
|
MouseEventKind::ScrollDown => self.next(),
|
||||||
@@ -534,7 +534,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Change state to next, depending which panel is currently in focus
|
/// Change state to next, depending which panel is currently in focus
|
||||||
fn next(&mut self) {
|
fn next(&self) {
|
||||||
let mut locked_data = self.app_data.lock();
|
let mut locked_data = self.app_data.lock();
|
||||||
let selected_panel = self.gui_state.lock().get_selected_panel();
|
let selected_panel = self.gui_state.lock().get_selected_panel();
|
||||||
match selected_panel {
|
match selected_panel {
|
||||||
@@ -545,7 +545,7 @@ impl InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Change state to previous, depending which panel is currently in focus
|
/// Change state to previous, depending which panel is currently in focus
|
||||||
fn previous(&mut self) {
|
fn previous(&self) {
|
||||||
let mut locked_data = self.app_data.lock();
|
let mut locked_data = self.app_data.lock();
|
||||||
let selected_panel = self.gui_state.lock().get_selected_panel();
|
let selected_panel = self.gui_state.lock().get_selected_panel();
|
||||||
match selected_panel {
|
match selected_panel {
|
||||||
|
|||||||
+3
-3
@@ -209,7 +209,7 @@ impl GuiState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check if a given Rect (a clicked area of 1x1), interacts with any known delete button
|
/// Check if a given Rect (a clicked area of 1x1), interacts with any known delete button
|
||||||
pub fn button_intersect(&mut self, rect: Rect) -> Option<DeleteButton> {
|
pub fn button_intersect(&self, rect: Rect) -> Option<DeleteButton> {
|
||||||
self.delete_map
|
self.delete_map
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|i| i.1.intersects(rect))
|
.filter(|i| i.1.intersects(rect))
|
||||||
@@ -219,7 +219,7 @@ impl GuiState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check if a given Rect (a clicked area of 1x1), interacts with any known panels
|
/// Check if a given Rect (a clicked area of 1x1), interacts with any known panels
|
||||||
pub fn header_intersect(&mut self, rect: Rect) -> Option<Header> {
|
pub fn header_intersect(&self, rect: Rect) -> Option<Header> {
|
||||||
self.heading_map
|
self.heading_map
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|i| i.1.intersects(rect))
|
.filter(|i| i.1.intersects(rect))
|
||||||
@@ -295,7 +295,7 @@ impl GuiState {
|
|||||||
self.status.insert(Status::Exec);
|
self.status.insert(Status::Exec);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_exec_mode(&mut self) -> Option<ExecMode> {
|
pub fn get_exec_mode(&self) -> Option<ExecMode> {
|
||||||
self.exec_mode.clone()
|
self.exec_mode.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user