address clippy lints

This commit is contained in:
Ferdinand Schober
2023-12-10 15:23:57 +01:00
parent 5c8ea25563
commit ebf5a64f20
13 changed files with 116 additions and 117 deletions

View File

@@ -89,6 +89,12 @@ pub struct ClientManager {
clients: Vec<Option<ClientState>>, // HashMap likely not beneficial
}
impl Default for ClientManager {
fn default() -> Self {
Self::new()
}
}
impl ClientManager {
pub fn new() -> Self {
Self { clients: vec![] }
@@ -174,12 +180,12 @@ impl ClientManager {
}
// returns an immutable reference to the client state corresponding to `client`
pub fn get<'a>(&'a self, client: ClientHandle) -> Option<&'a ClientState> {
pub fn get(&self, client: ClientHandle) -> Option<&ClientState> {
self.clients.get(client as usize)?.as_ref()
}
/// returns a mutable reference to the client state corresponding to `client`
pub fn get_mut<'a>(&'a mut self, client: ClientHandle) -> Option<&'a mut ClientState> {
pub fn get_mut(&mut self, client: ClientHandle) -> Option<&mut ClientState> {
self.clients.get_mut(client as usize)?.as_mut()
}