Did some clippy things and wad.rs is being developed

This commit is contained in:
2023-06-19 22:09:30 +01:00
parent d9b51c254c
commit 3988c13bf0
4 changed files with 23 additions and 25 deletions

View File

@@ -2,7 +2,9 @@ use serde_derive::{Deserialize, Serialize};
use std::fmt;
use std::path::PathBuf;
use std::slice::Iter;
use std::cmp::Ordering;
#[derive(Default)]
pub struct CommandManager {
pub launcher: Option<PathBuf>,
pub iwad: Option<PathBuf>,
@@ -122,6 +124,7 @@ pub struct LauncherInfo {
pub name: String,
}
#[derive(Default)]
pub struct MultiManager<T> {
pub selectable: Vec<T>,
pub current_selected: Vec<usize>,
@@ -168,13 +171,10 @@ impl<T: Clone> MultiManager<T> {
self.selectable.remove(index);
let mut new_selected: Vec<usize> = Vec::new();
for s in &self.current_selected {
println!("{}", s);
if *s == index {
continue
} else if *s > index {
new_selected.push(s - 1);
} else {
new_selected.push(*s);
match s.cmp(&index) {
Ordering::Equal => continue,
Ordering::Less => new_selected.push(*s),
Ordering::Greater => new_selected.push(s - 1),
}
}
self.current_selected = new_selected;
@@ -192,6 +192,7 @@ impl<T: Clone> MultiManager<T> {
}
}
#[derive(Default)]
pub struct SingleManager<T> {
pub selectable: Vec<T>,
pub current_selected: Option<usize>,