chore: linting nursery
This commit is contained in:
@@ -68,15 +68,11 @@ impl<T> StatefulList<T> {
|
||||
String::from("")
|
||||
} else {
|
||||
let len = self.items.len();
|
||||
let c = if let Some(value) = self.state.selected() {
|
||||
if len > 0 {
|
||||
let c = self.state.selected().map_or(0, |value| if len > 0 {
|
||||
value + 1
|
||||
} else {
|
||||
value
|
||||
}
|
||||
} else {
|
||||
0
|
||||
};
|
||||
});
|
||||
format!("{}/{}", c, self.items.len())
|
||||
}
|
||||
}
|
||||
@@ -95,7 +91,7 @@ pub enum State {
|
||||
}
|
||||
|
||||
impl State {
|
||||
pub fn get_color(&self) -> Color {
|
||||
pub const fn get_color(&self) -> Color {
|
||||
match self {
|
||||
Self::Running => Color::Green,
|
||||
Self::Removing => Color::LightRed,
|
||||
@@ -105,7 +101,7 @@ impl State {
|
||||
}
|
||||
}
|
||||
// Dirty way to create order for the state, rather than impl Ord
|
||||
pub fn order(&self) -> &'static str {
|
||||
pub const fn order(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Running => "a",
|
||||
Self::Paused => "b",
|
||||
@@ -158,7 +154,7 @@ pub enum DockerControls {
|
||||
}
|
||||
|
||||
impl DockerControls {
|
||||
pub fn get_color(&self) -> Color {
|
||||
pub const fn get_color(&self) -> Color {
|
||||
match self {
|
||||
Self::Start => Color::Green,
|
||||
Self::Stop => Color::Red,
|
||||
@@ -205,7 +201,7 @@ pub struct CpuStats {
|
||||
}
|
||||
|
||||
impl CpuStats {
|
||||
pub fn new(value: f64) -> Self {
|
||||
pub const fn new(value: f64) -> Self {
|
||||
Self { value }
|
||||
}
|
||||
}
|
||||
@@ -276,7 +272,7 @@ impl Ord for ByteStats {
|
||||
}
|
||||
|
||||
impl ByteStats {
|
||||
pub fn new(value: u64) -> Self {
|
||||
pub const fn new(value: u64) -> Self {
|
||||
Self { value }
|
||||
}
|
||||
pub fn update(&mut self, value: u64) {
|
||||
@@ -423,8 +419,8 @@ pub struct Columns {
|
||||
}
|
||||
|
||||
impl Columns {
|
||||
// (Column titles, minimum header string length)
|
||||
pub fn new() -> Self {
|
||||
/// (Column titles, minimum header string length)
|
||||
pub const fn new() -> Self {
|
||||
Self {
|
||||
state: (Header::State, 11),
|
||||
status: (Header::Status, 16),
|
||||
|
||||
+1
-5
@@ -259,11 +259,7 @@ impl AppData {
|
||||
/// Get the title for log panel for selected container
|
||||
/// will be "logs x/x"
|
||||
pub fn get_log_title(&self) -> String {
|
||||
if let Some(index) = self.get_selected_log_index() {
|
||||
self.containers.items[index].logs.get_state_title()
|
||||
} else {
|
||||
String::from("")
|
||||
}
|
||||
self.get_selected_log_index().map_or_else(|| String::from(""), |index| self.containers.items[index].logs.get_state_title())
|
||||
}
|
||||
|
||||
/// select next selected log line
|
||||
|
||||
Reference in New Issue
Block a user