chore: Rust 1.84 linting

This commit is contained in:
Jack Wills
2025-01-09 16:40:17 +00:00
parent bc47e2f6e5
commit 3065265e26
3 changed files with 11 additions and 11 deletions
+9 -9
View File
@@ -278,12 +278,12 @@ impl AppData {
fn set_sorted(&mut self, x: Option<(Header, SortedOrder)>) { fn set_sorted(&mut self, x: Option<(Header, SortedOrder)>) {
self.sorted_by = x; self.sorted_by = x;
self.sort_containers(); self.sort_containers();
self.containers self.containers.state.select(
.state self.containers
.select(self.containers.items.iter().position(|i| { .items
self.get_selected_container_id() .iter()
.map_or(false, |id| i.id == id) .position(|i| self.get_selected_container_id().as_ref() == Some(&i.id)),
})); );
} }
/// Remove the sorted header & order, and sort by default - created datetime /// Remove the sorted header & order, and sort by default - created datetime
@@ -676,13 +676,13 @@ impl AppData {
/// So that can disallow commands to be send /// So that can disallow commands to be send
/// Is a shabby way of implementing this /// Is a shabby way of implementing this
pub fn is_oxker(&self) -> bool { pub fn is_oxker(&self) -> bool {
self.get_selected_container().map_or(false, |i| i.is_oxker) self.get_selected_container().is_some_and(|i| i.is_oxker)
} }
/// Check if selected container is oxker and also that oxker is being run in a container /// Check if selected container is oxker and also that oxker is being run in a container
pub fn is_oxker_in_container(&self) -> bool { pub fn is_oxker_in_container(&self) -> bool {
self.get_selected_container() self.get_selected_container()
.map_or(false, |i| i.is_oxker && self.args.in_container) .is_some_and(|i| i.is_oxker && self.args.in_container)
} }
/// Find the widths for the strings in the containers panel. /// Find the widths for the strings in the containers panel.
@@ -817,7 +817,7 @@ impl AppData {
let is_oxker = i let is_oxker = i
.command .command
.as_ref() .as_ref()
.map_or(false, |i| i.starts_with(ENTRY_POINT)); .is_some_and(|i| i.starts_with(ENTRY_POINT));
let status = ContainerStatus::from( let status = ContainerStatus::from(
i.status i.status
+1 -1
View File
@@ -217,7 +217,7 @@ impl DockerData {
if self.args.in_container if self.args.in_container
&& f.command && f.command
.as_ref() .as_ref()
.map_or(false, |c| c.starts_with(ENTRY_POINT)) .is_some_and(|c| c.starts_with(ENTRY_POINT))
&& self.args.show_self && self.args.show_self
{ {
None None
+1 -1
View File
@@ -70,7 +70,7 @@ impl CliArgs {
/// An ENV is set in the ./containerised/Dockerfile, if this is ENV found, then sleep for 250ms, else the container, for as yet unknown reasons, will close immediately /// An ENV is set in the ./containerised/Dockerfile, if this is ENV found, then sleep for 250ms, else the container, for as yet unknown reasons, will close immediately
/// returns a bool, so that the `update_all_containers()` won't bother to check the entry point unless running via a container /// returns a bool, so that the `update_all_containers()` won't bother to check the entry point unless running via a container
fn check_if_in_container() -> bool { fn check_if_in_container() -> bool {
std::env::var(ENV_KEY).map_or(false, |i| i == ENV_VALUE) std::env::var(ENV_KEY).is_ok_and(|i| i == ENV_VALUE)
} }
/// Parse cli arguments /// Parse cli arguments