clippy
This commit is contained in:
@@ -208,7 +208,7 @@ pub fn openvr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
|
|||||||
overlays.handle_task(&mut app, task)?;
|
overlays.handle_task(&mut app, task)?;
|
||||||
}
|
}
|
||||||
TaskType::Playspace(task) => {
|
TaskType::Playspace(task) => {
|
||||||
playspace.handle_task(&mut app, &mut chaperone_mgr, task);
|
playspace.handle_task(&app, &mut chaperone_mgr, task);
|
||||||
}
|
}
|
||||||
TaskType::OpenVR(task) => match task {
|
TaskType::OpenVR(task) => match task {
|
||||||
OpenVrTask::ColorGain(channel, value) => {
|
OpenVrTask::ColorGain(channel, value) => {
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
|
|||||||
}
|
}
|
||||||
TaskType::Playspace(task) => {
|
TaskType::Playspace(task) => {
|
||||||
if let (Some(playspace), Some(monado)) = (playspace.as_mut(), monado.as_mut()) {
|
if let (Some(playspace), Some(monado)) = (playspace.as_mut(), monado.as_mut()) {
|
||||||
playspace.handle_task(&mut app, monado, task);
|
playspace.handle_task(&app, monado, task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "openvr")]
|
#[cfg(feature = "openvr")]
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ pub(super) fn setup_custom_button<S: 'static>(
|
|||||||
for i in 0..5 {
|
for i in 0..5 {
|
||||||
Toast::new(
|
Toast::new(
|
||||||
ToastTopic::System,
|
ToastTopic::System,
|
||||||
format!("Fixing floor in {}", 5 - i).into(),
|
format!("Fixing floor in {}", 5 - i),
|
||||||
"Touch your controller to the floor!".into(),
|
"Touch your controller to the floor!".into(),
|
||||||
)
|
)
|
||||||
.with_timeout(1.)
|
.with_timeout(1.)
|
||||||
@@ -141,7 +141,7 @@ pub(super) fn setup_custom_button<S: 'static>(
|
|||||||
Ok(EventResult::Consumed)
|
Ok(EventResult::Consumed)
|
||||||
}),
|
}),
|
||||||
"::ShellExec" => {
|
"::ShellExec" => {
|
||||||
let state = Arc::new(ShellButtonState {
|
let state = Rc::new(ShellButtonState {
|
||||||
button: button.clone(),
|
button: button.clone(),
|
||||||
exec: args.fold(String::new(), |c, n| c + " " + n),
|
exec: args.fold(String::new(), |c, n| c + " " + n),
|
||||||
mut_state: RefCell::new(ShellButtonMutableState::default()),
|
mut_state: RefCell::new(ShellButtonMutableState::default()),
|
||||||
@@ -171,7 +171,7 @@ pub(super) fn setup_custom_button<S: 'static>(
|
|||||||
"::OscSend" => {
|
"::OscSend" => {
|
||||||
use crate::subsystem::osc::parse_osc_value;
|
use crate::subsystem::osc::parse_osc_value;
|
||||||
|
|
||||||
let Some(address) = args.next().map(|s| s.to_string()) else {
|
let Some(address) = args.next().map(std::string::ToString::to_string) else {
|
||||||
log::error!("{command} has missing arguments");
|
log::error!("{command} has missing arguments");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -248,7 +248,7 @@ fn shell_on_action(state: &ShellButtonState) -> anyhow::Result<()> {
|
|||||||
mut_state.pid = Some(child.id());
|
mut_state.pid = Some(child.id());
|
||||||
mut_state.reader = Some(PipeReaderThread::new_from_child(child));
|
mut_state.reader = Some(PipeReaderThread::new_from_child(child));
|
||||||
|
|
||||||
return Ok(());
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn shell_on_tick(state: &ShellButtonState, common: &mut event::CallbackDataCommon, piped: bool) {
|
fn shell_on_tick(state: &ShellButtonState, common: &mut event::CallbackDataCommon, piped: bool) {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ impl PipeReaderThread {
|
|||||||
}
|
}
|
||||||
c.wait()
|
c.wait()
|
||||||
.inspect_err(|e| log::error!("Failed to wait for child process: {e:?}"))
|
.inspect_err(|e| log::error!("Failed to wait for child process: {e:?}"))
|
||||||
.map_or(false, |c| c.success())
|
.is_ok_and(|c| c.success())
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ impl PipeReaderThread {
|
|||||||
self.handle.is_finished()
|
self.handle.is_finished()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_success(self) -> bool {
|
pub fn check_success(self) -> bool {
|
||||||
self.handle.join().unwrap_or(false)
|
self.handle.join().unwrap_or(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,11 +210,10 @@ fn shell_on_tick(
|
|||||||
label.set_text(common, Translation::from_raw_text(&text));
|
label.set_text(common, Translation::from_raw_text(&text));
|
||||||
}
|
}
|
||||||
|
|
||||||
if reader.is_finished() {
|
if reader.is_finished()
|
||||||
if !mut_state.reader.take().unwrap().is_success() {
|
&& !mut_state.reader.take().unwrap().is_success() {
|
||||||
mut_state.next_try = Instant::now() + Duration::from_secs(15);
|
mut_state.next_try = Instant::now() + Duration::from_secs(15);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
} else if mut_state.next_try > Instant::now() {
|
} else if mut_state.next_try > Instant::now() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
@@ -229,7 +228,7 @@ fn shell_on_tick(
|
|||||||
|
|
||||||
mut_state.reader = Some(PipeReaderThread::new_from_child(child));
|
mut_state.reader = Some(PipeReaderThread::new_from_child(child));
|
||||||
|
|
||||||
return Ok(());
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FifoLabelState {
|
struct FifoLabelState {
|
||||||
@@ -303,12 +302,11 @@ fn fifo_on_tick(
|
|||||||
label.set_text(common, Translation::from_raw_text(&text));
|
label.set_text(common, Translation::from_raw_text(&text));
|
||||||
}
|
}
|
||||||
|
|
||||||
if reader.is_finished() {
|
if reader.is_finished()
|
||||||
if !mut_state.reader.take().unwrap().is_success() {
|
&& !mut_state.reader.take().unwrap().is_success() {
|
||||||
mut_state.next_try = Instant::now() + Duration::from_secs(15);
|
mut_state.next_try = Instant::now() + Duration::from_secs(15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const BAT_LOW: drawing::Color = drawing::Color::new(0.69, 0.38, 0.38, 1.);
|
const BAT_LOW: drawing::Color = drawing::Color::new(0.69, 0.38, 0.38, 1.);
|
||||||
const BAT_NORMAL: drawing::Color = drawing::Color::new(0.55, 0.84, 0.79, 1.);
|
const BAT_NORMAL: drawing::Color = drawing::Color::new(0.55, 0.84, 0.79, 1.);
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ pub fn parse_osc_value(s: &str) -> anyhow::Result<OscType> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
anyhow::bail!("Unknown OSC type literal: {}", s)
|
anyhow::bail!("Unknown OSC type literal: {s}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ where
|
|||||||
}
|
}
|
||||||
OverlayTask::CleanupMirrors => {
|
OverlayTask::CleanupMirrors => {
|
||||||
let mut ids_to_remove = vec![];
|
let mut ids_to_remove = vec![];
|
||||||
for (oid, o) in self.overlays.iter() {
|
for (oid, o) in &self.overlays {
|
||||||
if !matches!(o.config.category, OverlayCategory::Mirror) {
|
if !matches!(o.config.category, OverlayCategory::Mirror) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user