fix: clippy errors
This commit is contained in:
1 parent
441607f0da
commit
1feb1679ff
4 files changed
+9
-19
No files matched your search
+1
-1
@@ -65,7 +65,7 @@ fn manager() -> InstanceManager {
|
|||||||
|
|
||||||
fn list_instances() -> CliResult {
|
fn list_instances() -> CliResult {
|
||||||
let mut instances = manager().load_all();
|
let mut instances = manager().load_all();
|
||||||
instances.sort_by(|left, right| left.name.to_lowercase().cmp(&right.name.to_lowercase()));
|
instances.sort_by_key(|instance| instance.name.to_lowercase());
|
||||||
|
|
||||||
let rows = instances
|
let rows = instances
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|||||||
@@ -164,10 +164,8 @@ fn handle_version_key(
|
|||||||
state.version_idx = 0;
|
state.version_idx = 0;
|
||||||
state.version_search.deactivate();
|
state.version_search.deactivate();
|
||||||
}
|
}
|
||||||
KeyCode::Char('j') | KeyCode::Down => {
|
KeyCode::Char('j') | KeyCode::Down if visible_count > 0 => {
|
||||||
if visible_count > 0 {
|
state.version_idx = (state.version_idx + 1).min(visible_count.saturating_sub(1));
|
||||||
state.version_idx = (state.version_idx + 1).min(visible_count.saturating_sub(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
KeyCode::Char('k') | KeyCode::Up => {
|
KeyCode::Char('k') | KeyCode::Up => {
|
||||||
state.version_idx = state.version_idx.saturating_sub(1);
|
state.version_idx = state.version_idx.saturating_sub(1);
|
||||||
|
|||||||
@@ -202,10 +202,8 @@ fn handle_version_key(
|
|||||||
KeyCode::Left | KeyCode::Char('h') if !state.version_search.active => {
|
KeyCode::Left | KeyCode::Char('h') if !state.version_search.active => {
|
||||||
state.step = WizardStep::Loader;
|
state.step = WizardStep::Loader;
|
||||||
}
|
}
|
||||||
KeyCode::Char('j') | KeyCode::Down => {
|
KeyCode::Char('j') | KeyCode::Down if visible_count > 0 => {
|
||||||
if visible_count > 0 {
|
state.version_idx = (state.version_idx + 1).min(visible_count.saturating_sub(1));
|
||||||
state.version_idx = (state.version_idx + 1).min(visible_count.saturating_sub(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
KeyCode::Char('k') | KeyCode::Up => {
|
KeyCode::Char('k') | KeyCode::Up => {
|
||||||
state.version_idx = state.version_idx.saturating_sub(1);
|
state.version_idx = state.version_idx.saturating_sub(1);
|
||||||
@@ -286,11 +284,9 @@ fn handle_loader_version_key(
|
|||||||
match key_event.code {
|
match key_event.code {
|
||||||
KeyCode::Esc => close_popup(state, instances_state),
|
KeyCode::Esc => close_popup(state, instances_state),
|
||||||
KeyCode::Left | KeyCode::Char('h') => state.step = WizardStep::Version,
|
KeyCode::Left | KeyCode::Char('h') => state.step = WizardStep::Version,
|
||||||
KeyCode::Char('j') | KeyCode::Down => {
|
KeyCode::Char('j') | KeyCode::Down if version_count > 0 => {
|
||||||
if version_count > 0 {
|
state.loader_version_idx =
|
||||||
state.loader_version_idx =
|
(state.loader_version_idx + 1).min(version_count.saturating_sub(1));
|
||||||
(state.loader_version_idx + 1).min(version_count.saturating_sub(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
KeyCode::Char('k') | KeyCode::Up => {
|
KeyCode::Char('k') | KeyCode::Up => {
|
||||||
state.loader_version_idx = state.loader_version_idx.saturating_sub(1);
|
state.loader_version_idx = state.loader_version_idx.saturating_sub(1);
|
||||||
|
|||||||
@@ -155,11 +155,7 @@ impl ScreenshotsState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn ensure_visible(&mut self) {
|
fn ensure_visible(&mut self) {
|
||||||
let row = if self.cols > 0 {
|
let row = self.selected.checked_div(self.cols).unwrap_or(0);
|
||||||
self.selected / self.cols
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
if row < self.scroll_row {
|
if row < self.scroll_row {
|
||||||
self.scroll_row = row;
|
self.scroll_row = row;
|
||||||
|
|||||||
Reference in new issue
Block a user