fix: use default trait properly with enums
Some checks failed
/ cargo-clippy (push) Has been cancelled
/ cargo-fmtcheck (push) Has been cancelled
/ cargo-test (push) Has been cancelled
/ appimage (push) Has been cancelled

This commit is contained in:
Gabriele Musco 2024-09-12 20:46:31 +02:00
commit 6feba023af
No known key found for this signature in database
GPG key ID: 1068D795C80E51DE
3 changed files with 6 additions and 21 deletions

View file

@ -188,19 +188,14 @@ impl Default for ProfileFeatures {
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum LighthouseDriver {
#[default]
Vive,
Survive,
SteamVR,
}
impl Default for LighthouseDriver {
fn default() -> Self {
Self::Vive
}
}
impl From<&str> for LighthouseDriver {
fn from(s: &str) -> Self {
match s.trim().to_lowercase().as_str() {

View file

@ -5,19 +5,14 @@ use crate::{
use adw::prelude::*;
use relm4::{factory::AsyncFactoryComponent, prelude::*, AsyncFactorySender};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
pub enum DeviceRowState {
#[default]
Ok,
Error,
Warning,
}
impl Default for DeviceRowState {
fn default() -> Self {
Self::Ok
}
}
impl DeviceRowState {
pub fn icon(&self) -> &str {
match &self {

View file

@ -1,7 +1,7 @@
use libmonado_rs::{self, BatteryStatus, DeviceRole};
use std::{collections::HashMap, fmt::Display, slice::Iter};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
pub enum XRDeviceRole {
Head,
Eyes,
@ -25,15 +25,10 @@ pub enum XRDeviceRole {
Camera,
Keyboard,
#[default]
GenericTracker,
}
impl Default for XRDeviceRole {
fn default() -> Self {
Self::GenericTracker
}
}
impl Display for XRDeviceRole {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {