clippy
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
use anyhow::Context;
|
||||
use glam::{vec2, Vec2};
|
||||
use std::sync::Arc;
|
||||
use testbed::{testbed_any::TestbedAny, Testbed};
|
||||
|
||||
@@ -235,7 +235,7 @@ impl Pointer {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn hand(&self) -> Option<LeftRight> {
|
||||
pub const fn hand(&self) -> Option<LeftRight> {
|
||||
match self.idx {
|
||||
0 => Some(LeftRight::Left),
|
||||
1 => Some(LeftRight::Right),
|
||||
@@ -679,12 +679,12 @@ where
|
||||
// single grab push/pull
|
||||
grab_data.offset.translation.z -= pointer.now.scroll_y * 0.05;
|
||||
}
|
||||
if !pointer.now.click_modifier_right {
|
||||
if pointer.now.click_modifier_right {
|
||||
app.anchor = pointer.pose * grab_data.offset;
|
||||
} else {
|
||||
app.anchor.translation =
|
||||
pointer.pose.transform_point3a(grab_data.offset.translation);
|
||||
realign(&mut app.anchor, &app.input_state.hmd);
|
||||
} else {
|
||||
app.anchor = pointer.pose * grab_data.offset;
|
||||
}
|
||||
} else {
|
||||
// single grab resize
|
||||
@@ -695,12 +695,12 @@ where
|
||||
// single grab push/pull
|
||||
grab_data.offset.translation.z -= pointer.now.scroll_y * 0.05;
|
||||
}
|
||||
if !pointer.now.click_modifier_right {
|
||||
if pointer.now.click_modifier_right {
|
||||
overlay_state.transform = pointer.pose * grab_data.offset;
|
||||
} else {
|
||||
overlay_state.transform.translation =
|
||||
pointer.pose.transform_point3a(grab_data.offset.translation);
|
||||
realign(&mut overlay_state.transform, &app.input_state.hmd);
|
||||
} else {
|
||||
overlay_state.transform = pointer.pose * grab_data.offset;
|
||||
}
|
||||
overlay.config.pause_movement = true;
|
||||
overlay.config.dirty = true;
|
||||
|
||||
@@ -61,9 +61,9 @@ impl PositioningHandler {
|
||||
buttons.insert(
|
||||
*name,
|
||||
Rc::new(PosButtonState {
|
||||
component,
|
||||
name,
|
||||
sprite,
|
||||
component,
|
||||
positioning,
|
||||
has_interpolation,
|
||||
}),
|
||||
|
||||
@@ -235,7 +235,7 @@ impl OverlayBackend for ScreenBackend {
|
||||
MOUSE_RIGHT => MOUSE_LEFT,
|
||||
other => other,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
if pressed {
|
||||
set_next_move(u64::from(app.session.config.click_freeze_time_ms));
|
||||
|
||||
@@ -44,8 +44,8 @@ pub const WATCH_NAME: &str = "watch";
|
||||
const MAX_TOOLBOX_BUTTONS: usize = 16;
|
||||
const MAX_DEVICES: usize = 9;
|
||||
|
||||
pub(crate) const WATCH_POS: Vec3 = vec3(-0.03, -0.01, 0.125);
|
||||
pub(crate) const WATCH_ROT: Quat = Quat::from_xyzw(-0.707_106_6, 0.000_796_361_8, 0.707_106_6, 0.0);
|
||||
pub const WATCH_POS: Vec3 = vec3(-0.03, -0.01, 0.125);
|
||||
pub const WATCH_ROT: Quat = Quat::from_xyzw(-0.707_106_6, 0.000_796_361_8, 0.707_106_6, 0.0);
|
||||
|
||||
#[derive(Default)]
|
||||
struct WatchState {
|
||||
|
||||
@@ -104,7 +104,7 @@ impl AppState {
|
||||
Box::new(gui::asset::GuiAsset {}),
|
||||
wgui::globals::Defaults::default(),
|
||||
&WguiFontConfig::default(),
|
||||
get_config_file_path(&*theme),
|
||||
get_config_file_path(&theme),
|
||||
)?,
|
||||
|
||||
#[cfg(feature = "osc")]
|
||||
|
||||
@@ -216,12 +216,10 @@ where
|
||||
OverlayTask::Drop(sel) => {
|
||||
if let Some(o) = self.mut_by_selector(&sel)
|
||||
&& o.birthframe < FRAME_COUNTER.load(Ordering::Relaxed)
|
||||
{
|
||||
if let Some(o) = self.remove_by_selector(&sel, app) {
|
||||
&& let Some(o) = self.remove_by_selector(&sel, app) {
|
||||
log::debug!("Dropping overlay {}", o.config.name);
|
||||
self.dropped_overlays.push_back(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@@ -258,7 +256,7 @@ impl<T> OverlayWindowManager<T> {
|
||||
.collect();
|
||||
|
||||
// overlays that we haven't seen since startup (e.g. wayvr apps)
|
||||
for (k, o) in set.inactive_overlays.iter() {
|
||||
for (k, o) in &set.inactive_overlays {
|
||||
if !overlays.contains_key(k) {
|
||||
overlays.insert(k.clone(), o.clone());
|
||||
}
|
||||
@@ -311,8 +309,8 @@ impl<T> OverlayWindowManager<T> {
|
||||
let mut overlays = SecondaryMap::new();
|
||||
let mut inactive_overlays = AStrMap::new();
|
||||
|
||||
for (name, o) in s.overlays.iter() {
|
||||
if let Some(id) = self.lookup(&*name) {
|
||||
for (name, o) in &s.overlays {
|
||||
if let Some(id) = self.lookup(name) {
|
||||
log::debug!("set {i}: loaded state for {name}");
|
||||
overlays.insert(id, o.clone());
|
||||
} else {
|
||||
@@ -477,7 +475,7 @@ impl<T> OverlayWindowManager<T> {
|
||||
|
||||
if !global {
|
||||
for (i, set) in self.sets.iter_mut().enumerate() {
|
||||
let Some(mut state) = set.inactive_overlays.arc_rm(&*name) else {
|
||||
let Some(mut state) = set.inactive_overlays.arc_rm(&name) else {
|
||||
continue;
|
||||
};
|
||||
if self.current_set == Some(i) {
|
||||
@@ -495,7 +493,7 @@ impl<T> OverlayWindowManager<T> {
|
||||
}
|
||||
|
||||
if !shown && show_on_spawn {
|
||||
log::debug!("activating {} due to show_on_spawn", name);
|
||||
log::debug!("activating {name} due to show_on_spawn");
|
||||
self.overlays[oid].config.activate(app);
|
||||
}
|
||||
if !internal && let Err(e) = self.overlays_changed(app) {
|
||||
|
||||
@@ -104,7 +104,7 @@ impl OverlayWindowConfig {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_active(&self) -> bool {
|
||||
pub const fn is_active(&self) -> bool {
|
||||
self.active_state.is_some()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user