cleanup: no more clippy warnings
This commit is contained in:
@@ -17,7 +17,6 @@ use stardust_xr_fusion::{
|
||||
use stardust_xr_molecules::{GrabData, Grabbable};
|
||||
use std::f32::consts::PI;
|
||||
|
||||
|
||||
const APP_LIMIT: usize = 300;
|
||||
const APP_SIZE: f32 = 0.05;
|
||||
const GRID_PADDING: f32 = 0.01;
|
||||
@@ -80,7 +79,7 @@ impl RootHandler for AppGrid {
|
||||
}
|
||||
|
||||
fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
|
||||
return match &icon.icon_type {
|
||||
match &icon.icon_type {
|
||||
IconType::Png => {
|
||||
// let t = Transform::from_rotation_scale(
|
||||
// Quat::from_rotation_x(PI / 2.0) * Quat::from_rotation_y(PI),
|
||||
@@ -107,7 +106,7 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
|
||||
&ResourceID::new_direct(icon.path.clone())?,
|
||||
)?),
|
||||
_ => panic!("Invalid Icon Type"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub struct App {
|
||||
|
||||
@@ -218,7 +218,7 @@ impl RootHandler for Button {
|
||||
// Model handling
|
||||
|
||||
fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
|
||||
return match &icon.icon_type {
|
||||
match &icon.icon_type {
|
||||
IconType::Png => {
|
||||
let t = Transform::from_rotation_scale(
|
||||
Quat::from_rotation_x(PI / 2.0) * Quat::from_rotation_y(PI),
|
||||
@@ -245,7 +245,7 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
|
||||
&ResourceID::new_direct(icon.path.clone())?,
|
||||
)?),
|
||||
_ => panic!("Invalid Icon Type"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub struct App {
|
||||
@@ -341,7 +341,9 @@ impl App {
|
||||
self.grabbable_move = Some(Tweener::quart_in_out(1.0, 0.0001, 0.25)); //TODO make the scale a parameter
|
||||
} else {
|
||||
self.icon.set_enabled(true).unwrap();
|
||||
self.label.as_ref().map(|l| l.set_enabled(true).unwrap());
|
||||
if let Some(label) = self.label.as_ref() {
|
||||
label.set_enabled(true).unwrap()
|
||||
}
|
||||
self.grabbable_move = Some(Tweener::quart_in_out(0.0001, 1.0, 0.25));
|
||||
}
|
||||
self.currently_shown = !self.currently_shown;
|
||||
@@ -368,7 +370,9 @@ impl RootHandler for App {
|
||||
} else {
|
||||
if grabbable_move.final_value() == 0.0001 {
|
||||
self.icon.set_enabled(false).unwrap();
|
||||
self.label.as_ref().map(|l| l.set_enabled(false).unwrap());
|
||||
if let Some(label) = self.label.as_ref() {
|
||||
label.set_enabled(false).unwrap()
|
||||
}
|
||||
}
|
||||
self.grabbable_move = None;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ impl RootHandler for Sirius {
|
||||
println!("{}", starpos);
|
||||
star.content_parent()
|
||||
.set_position(
|
||||
Some(&self.grabbable.content_parent()),
|
||||
Some(self.grabbable.content_parent()),
|
||||
[starpos, 0.1, 0.0],
|
||||
)
|
||||
.ok();
|
||||
@@ -155,7 +155,7 @@ impl RootHandler for Sirius {
|
||||
false => {
|
||||
for star in &self.clients {
|
||||
star.content_parent()
|
||||
.set_position(Some(&self.grabbable.content_parent()), [0.0, 0.0, 0.0])
|
||||
.set_position(Some(self.grabbable.content_parent()), [0.0, 0.0, 0.0])
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ impl RootHandler for Sirius {
|
||||
}
|
||||
|
||||
fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
|
||||
return match &icon.icon_type {
|
||||
match &icon.icon_type {
|
||||
IconType::Png => {
|
||||
let t = Transform::from_rotation_scale(
|
||||
Quat::from_rotation_x(PI / 2.0) * Quat::from_rotation_y(PI),
|
||||
@@ -224,7 +224,7 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
|
||||
&ResourceID::new_direct(icon.path.clone())?,
|
||||
)?),
|
||||
_ => panic!("Invalid Icon Type"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub struct App {
|
||||
@@ -320,7 +320,9 @@ impl App {
|
||||
self.grabbable_move = Some(Tweener::quart_in_out(1.0, 0.0001, 0.25)); //TODO make the scale a parameter
|
||||
} else {
|
||||
self.icon.set_enabled(true).unwrap();
|
||||
self.label.as_ref().map(|l| l.set_enabled(true).unwrap());
|
||||
if let Some(label) = self.label.as_ref() {
|
||||
label.set_enabled(true).unwrap()
|
||||
}
|
||||
self.grabbable_move = Some(Tweener::quart_in_out(0.0001, 1.0, 0.25));
|
||||
}
|
||||
self.currently_shown = !self.currently_shown;
|
||||
@@ -347,7 +349,9 @@ impl RootHandler for App {
|
||||
} else {
|
||||
if grabbable_move.final_value() == 0.0001 {
|
||||
self.icon.set_enabled(false).unwrap();
|
||||
self.label.as_ref().map(|l| l.set_enabled(false).unwrap());
|
||||
if let Some(label) = self.label.as_ref() {
|
||||
label.set_enabled(false).unwrap()
|
||||
}
|
||||
}
|
||||
self.grabbable_move = None;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user