fix: compiler warnings

This commit is contained in:
Gabriele Musco 2023-08-15 13:39:52 +00:00
commit 625602a6cf
11 changed files with 31 additions and 27 deletions

View file

@ -3,7 +3,7 @@ use std::fmt::Display;
use crate::{ use crate::{
profile::Profile, profile::Profile,
profiles::{ profiles::{
lighthouse::lighthouse_profile, valve_index::valve_index_profile, wivrn::wivrn_profile, lighthouse::lighthouse_profile, wivrn::wivrn_profile,
}, },
}; };

View file

@ -40,13 +40,19 @@ fn restore_steam_xr_files() {
let active_runtime = get_current_active_runtime(); let active_runtime = get_current_active_runtime();
let openvrpaths = get_current_openvrpaths(); let openvrpaths = get_current_openvrpaths();
if active_runtime.is_some() { if active_runtime.is_some() {
if file_builders::active_runtime_json::is_steam(&active_runtime.unwrap()) { if !file_builders::active_runtime_json::is_steam(&active_runtime.unwrap()) {
set_current_active_runtime_to_steam(); match set_current_active_runtime_to_steam() {
Ok(_) => {}
Err(_) => println!("Warning: failed to restore active runtime to steam!"),
};
} }
} }
if openvrpaths.is_some() { if openvrpaths.is_some() {
if file_builders::openvrpaths_vrpath::is_steam(&openvrpaths.unwrap()) { if !file_builders::openvrpaths_vrpath::is_steam(&openvrpaths.unwrap()) {
set_current_openvrpaths_to_steam(); match set_current_openvrpaths_to_steam() {
Ok(_) => {}
Err(_) => println!("Warning: failed to restore openvrpaths to steam!"),
};
} }
} }
} }

View file

@ -27,9 +27,9 @@ impl SimpleComponent for AboutDialog {
} }
fn init( fn init(
init: Self::Init, _init: Self::Init,
root: &Self::Root, root: &Self::Root,
sender: relm4::ComponentSender<Self>, _sender: relm4::ComponentSender<Self>,
) -> relm4::ComponentParts<Self> { ) -> relm4::ComponentParts<Self> {
let model = AboutDialog {}; let model = AboutDialog {};
let widgets = root.clone(); let widgets = root.clone();

View file

@ -257,7 +257,7 @@ impl SimpleComponent for App {
} }
} }
fn shutdown(&mut self, widgets: &mut Self::Widgets, output: relm4::Sender<Self::Output>) { fn shutdown(&mut self, _widgets: &mut Self::Widgets, _output: relm4::Sender<Self::Output>) {
if self.xrservice_runner.is_some() { if self.xrservice_runner.is_some() {
if self.xrservice_runner.as_mut().unwrap().status() == RunnerStatus::Running { if self.xrservice_runner.as_mut().unwrap().status() == RunnerStatus::Running {
self.xrservice_runner.as_mut().unwrap().terminate(); self.xrservice_runner.as_mut().unwrap().terminate();

View file

@ -181,9 +181,9 @@ impl SimpleComponent for BuildWindow {
} }
fn init( fn init(
init: Self::Init, _init: Self::Init,
root: &Self::Root, root: &Self::Root,
sender: ComponentSender<Self>, _sender: ComponentSender<Self>,
) -> ComponentParts<Self> { ) -> ComponentParts<Self> {
let mut model = Self { let mut model = Self {
tracker: 0, tracker: 0,

View file

@ -226,7 +226,7 @@ impl SimpleComponent for DevicesBox {
} }
} }
fn update(&mut self, message: Self::Input, sender: ComponentSender<Self>) { fn update(&mut self, message: Self::Input, _sender: ComponentSender<Self>) {
self.reset(); self.reset();
match message { match message {
@ -237,9 +237,9 @@ impl SimpleComponent for DevicesBox {
} }
fn init( fn init(
init: Self::Init, _init: Self::Init,
root: &Self::Root, root: &Self::Root,
sender: ComponentSender<Self>, _sender: ComponentSender<Self>,
) -> ComponentParts<Self> { ) -> ComponentParts<Self> {
let model = Self { let model = Self {
tracker: 0, tracker: 0,

View file

@ -1,6 +1,5 @@
use crate::ui::profile_editor::ProfileEditorMsg; use crate::ui::profile_editor::ProfileEditorMsg;
use adw::prelude::*; use adw::prelude::*;
use gtk::prelude::*;
use relm4::prelude::*; use relm4::prelude::*;
#[derive(Debug)] #[derive(Debug)]
@ -77,7 +76,7 @@ impl FactoryComponent for EnvVarModel {
}) })
} }
fn init_model(init: Self::Init, index: &Self::Index, sender: FactorySender<Self>) -> Self { fn init_model(init: Self::Init, _index: &Self::Index, _sender: FactorySender<Self>) -> Self {
Self { Self {
name: init.name, name: init.name,
value: init.value, value: init.value,

View file

@ -324,7 +324,7 @@ impl SimpleComponent for MainView {
set_margin_end: 12, set_margin_end: 12,
set_halign: gtk::Align::Start, set_halign: gtk::Align::Start,
connect_clicked[sender] => move |_| { connect_clicked[sender] => move |_| {
sender.output(Self::Output::OpenLibsurviveSetup); sender.output(Self::Output::OpenLibsurviveSetup).expect("Sender outut failed");
} }
}, },
}, },
@ -409,10 +409,10 @@ impl SimpleComponent for MainView {
.emit(InstallWivrnBoxMsg::ClockTicking); .emit(InstallWivrnBoxMsg::ClockTicking);
} }
Self::Input::StartStopClicked => { Self::Input::StartStopClicked => {
sender.output(Self::Output::DoStartStopXRService); sender.output(Self::Output::DoStartStopXRService).expect("Sender output failed");
} }
Self::Input::RestartXRService => { Self::Input::RestartXRService => {
sender.output(Self::Output::RestartXRService); sender.output(Self::Output::RestartXRService).expect("Sender output failed");
} }
Self::Input::XRServiceActiveChanged(active, profile) => { Self::Input::XRServiceActiveChanged(active, profile) => {
self.set_xrservice_active(active); self.set_xrservice_active(active);
@ -475,7 +475,7 @@ impl SimpleComponent for MainView {
Self::Input::ProfileSelected(position) => { Self::Input::ProfileSelected(position) => {
sender.output(MainViewOutMsg::ProfileSelected( sender.output(MainViewOutMsg::ProfileSelected(
self.profiles.get(position as usize).unwrap().clone(), self.profiles.get(position as usize).unwrap().clone(),
)); )).expect("Sender output failed");
} }
Self::Input::EditProfile => { Self::Input::EditProfile => {
if self.selected_profile.editable { if self.selected_profile.editable {
@ -500,7 +500,7 @@ impl SimpleComponent for MainView {
self.profile_delete_confirm_dialog.present(); self.profile_delete_confirm_dialog.present();
} }
Self::Input::SaveProfile(prof) => { Self::Input::SaveProfile(prof) => {
sender.output(Self::Output::SaveProfile(prof)); sender.output(Self::Output::SaveProfile(prof)).expect("Sender output failed");
} }
Self::Input::DuplicateProfile => { Self::Input::DuplicateProfile => {
if self.selected_profile.can_be_built { if self.selected_profile.can_be_built {
@ -570,7 +570,7 @@ impl SimpleComponent for MainView {
let pdc_sender = sender.clone(); let pdc_sender = sender.clone();
profile_delete_confirm_dialog.connect_response(None, move |_, res| { profile_delete_confirm_dialog.connect_response(None, move |_, res| {
if res == "yes" { if res == "yes" {
pdc_sender.output(Self::Output::DeleteProfile); pdc_sender.output(Self::Output::DeleteProfile).expect("Sender output failed");
} }
}); });
} }

View file

@ -294,7 +294,7 @@ impl SimpleComponent for ProfileEditor {
Self::Input::SaveProfile => { Self::Input::SaveProfile => {
let prof = self.profile.borrow(); let prof = self.profile.borrow();
if prof.validate() { if prof.validate() {
sender.output(ProfileEditorOutMsg::SaveProfile(prof.clone())); sender.output(ProfileEditorOutMsg::SaveProfile(prof.clone())).expect("Sender output failed");
self.win.as_ref().unwrap().close(); self.win.as_ref().unwrap().close();
} else { } else {
self.win.as_ref().unwrap().add_toast( self.win.as_ref().unwrap().add_toast(

View file

@ -98,7 +98,7 @@ impl SimpleComponent for SteamLaunchOptionsBox {
} }
} }
fn update(&mut self, message: Self::Input, sender: ComponentSender<Self>) { fn update(&mut self, message: Self::Input, _sender: ComponentSender<Self>) {
self.reset(); self.reset();
match message { match message {
@ -118,7 +118,7 @@ impl SimpleComponent for SteamLaunchOptionsBox {
} }
fn init( fn init(
init: Self::Init, _init: Self::Init,
root: &Self::Root, root: &Self::Root,
sender: ComponentSender<Self>, sender: ComponentSender<Self>,
) -> ComponentParts<Self> { ) -> ComponentParts<Self> {

View file

@ -1,7 +1,6 @@
use crate::file_builders::wivrn_config::{dump_wivrn_config, get_wivrn_config, WivrnConfig, Encoder}; use crate::file_builders::wivrn_config::{dump_wivrn_config, get_wivrn_config, WivrnConfig, Encoder};
use adw::prelude::*; use adw::prelude::*;
use gtk::prelude::*; use relm4::prelude::*;
use relm4::{factory::FactoryVecDeque, prelude::*};
#[tracker::track] #[tracker::track]
pub struct WivrnConfEditor { pub struct WivrnConfEditor {
@ -114,7 +113,7 @@ impl SimpleComponent for WivrnConfEditor {
} }
} }
fn update(&mut self, message: Self::Input, sender: ComponentSender<Self>) { fn update(&mut self, message: Self::Input, _sender: ComponentSender<Self>) {
self.reset(); self.reset();
match message { match message {