review unwraps
This commit is contained in:
@@ -547,7 +547,7 @@ impl Pointer {
|
||||
}
|
||||
config.transform_values.arc_set(
|
||||
overlay.state.name.clone(),
|
||||
overlay.state.saved_transform.unwrap(),
|
||||
overlay.state.saved_transform.unwrap(), // safe
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ use std::{
|
||||
};
|
||||
|
||||
use glam::{bool, Affine3A, Quat, Vec3};
|
||||
use libmonado_rs::{Device, Monado};
|
||||
use openxr::{self as xr, Quaternionf, Vector3f};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use libmonado_rs::{Monado, Device};
|
||||
|
||||
use crate::{
|
||||
backend::input::{Haptics, Pointer, TrackedDevice, TrackedDeviceRole},
|
||||
@@ -213,7 +213,7 @@ impl OpenXrInputSource {
|
||||
fn update_device_battery_status(
|
||||
device: &mut Device,
|
||||
role: TrackedDeviceRole,
|
||||
app: &mut AppState
|
||||
app: &mut AppState,
|
||||
) {
|
||||
if let Ok(status) = device.battery_status() {
|
||||
if status.present {
|
||||
@@ -222,8 +222,13 @@ impl OpenXrInputSource {
|
||||
charging: status.charging,
|
||||
role,
|
||||
});
|
||||
log::debug!("Device {} role {:#?}: {:.0}% (charging {})", device.index, role,
|
||||
status.charge * 100.0f32, status.charging);
|
||||
log::debug!(
|
||||
"Device {} role {:#?}: {:.0}% (charging {})",
|
||||
device.index,
|
||||
role,
|
||||
status.charge * 100.0f32,
|
||||
status.charging
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -420,7 +425,7 @@ fn to_path(maybe_path_str: &Option<String>, instance: &xr::Instance) -> Option<x
|
||||
fn is_bool(maybe_type_str: &Option<String>) -> bool {
|
||||
maybe_type_str
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.unwrap() // want panic
|
||||
.split('/')
|
||||
.last()
|
||||
.map(|last| matches!(last, "click" | "touch"))
|
||||
|
||||
@@ -252,7 +252,11 @@ pub fn openxr_run(running: Arc<AtomicBool>, show_by_default: bool) -> Result<(),
|
||||
|
||||
watch_fade(&mut app_state, overlays.mut_by_id(watch_id).unwrap()); // want panic
|
||||
if let Some(ref mut space_mover) = playspace {
|
||||
space_mover.update(&mut overlays, &app_state, monado.as_mut().unwrap());
|
||||
space_mover.update(
|
||||
&mut overlays,
|
||||
&app_state,
|
||||
monado.as_mut().unwrap(), // safe
|
||||
);
|
||||
}
|
||||
|
||||
for o in overlays.iter_mut() {
|
||||
@@ -432,12 +436,15 @@ pub fn openxr_run(running: Arc<AtomicBool>, show_by_default: bool) -> Result<(),
|
||||
TaskType::System(task) => match task {
|
||||
SystemTask::FixFloor => {
|
||||
if let Some(ref mut playspace) = playspace {
|
||||
playspace.fix_floor(&app_state.input_state, monado.as_mut().unwrap());
|
||||
playspace.fix_floor(
|
||||
&app_state.input_state,
|
||||
monado.as_mut().unwrap(), // safe
|
||||
);
|
||||
}
|
||||
}
|
||||
SystemTask::ResetPlayspace => {
|
||||
if let Some(ref mut playspace) = playspace {
|
||||
playspace.reset_offset(monado.as_mut().unwrap());
|
||||
playspace.reset_offset(monado.as_mut().unwrap()); // safe
|
||||
}
|
||||
}
|
||||
SystemTask::ShowHide => {
|
||||
|
||||
@@ -237,7 +237,7 @@ fn create_swapchain(
|
||||
.device
|
||||
.physical_device()
|
||||
.surface_capabilities(&surface, Default::default())
|
||||
.unwrap();
|
||||
.unwrap(); // want panic
|
||||
|
||||
let (swapchain, images) = Swapchain::new(
|
||||
graphics.device.clone(),
|
||||
@@ -251,13 +251,14 @@ fn create_swapchain(
|
||||
.supported_composite_alpha
|
||||
.into_iter()
|
||||
.next()
|
||||
.unwrap(),
|
||||
.unwrap(), // want panic
|
||||
..Default::default()
|
||||
},
|
||||
)?;
|
||||
|
||||
let image_views = images
|
||||
.into_iter()
|
||||
// want panic
|
||||
.map(|image| ImageView::new_default(image).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user