clippy(all): cleanup
This commit is contained in:
@@ -198,7 +198,7 @@ impl App {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
fn frame(&mut self, info: &FrameInfo) {
|
fn frame(&mut self, info: &FrameInfo) {
|
||||||
let _ = self.grabbable.update(&info);
|
let _ = self.grabbable.update(info);
|
||||||
|
|
||||||
if self.grabbable.grab_action().actor_stopped() {
|
if self.grabbable.grab_action().actor_stopped() {
|
||||||
self.grabbable.cancel_angular_velocity();
|
self.grabbable.cancel_angular_velocity();
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn frame(&mut self, info: &FrameInfo, state: &State) {
|
pub fn frame(&mut self, info: &FrameInfo, state: &State) {
|
||||||
let _ = self.grabbable.update(&info);
|
let _ = self.grabbable.update(info);
|
||||||
|
|
||||||
if let Some(grabbable_move) = &mut self.grabbable_move {
|
if let Some(grabbable_move) = &mut self.grabbable_move {
|
||||||
if !grabbable_move.is_finished() {
|
if !grabbable_move.is_finished() {
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
use std::ops::Add;
|
||||||
|
|
||||||
use crate::{APP_SIZE, PADDING};
|
use crate::{APP_SIZE, PADDING};
|
||||||
use tween::TweenTime;
|
use tween::TweenTime;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Copy, Debug, Default)]
|
||||||
pub struct Hex {
|
pub struct Hex {
|
||||||
q: isize,
|
q: isize,
|
||||||
r: isize,
|
r: isize,
|
||||||
@@ -30,15 +32,18 @@ impl Hex {
|
|||||||
[x, y, 0.0]
|
[x, y, 0.0]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add(self, vec: &Hex) -> Self {
|
|
||||||
Hex::new(self.q + vec.q, self.r + vec.r, self.s + vec.s)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn neighbor(self, direction: usize) -> Self {
|
pub fn neighbor(self, direction: usize) -> Self {
|
||||||
self.add(&HEX_DIRECTION_VECTORS[direction])
|
self + HEX_DIRECTION_VECTORS[direction]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn scale(self, factor: isize) -> Self {
|
pub fn scale(self, factor: isize) -> Self {
|
||||||
Hex::new(self.q * factor, self.r * factor, self.s * factor)
|
Hex::new(self.q * factor, self.r * factor, self.s * factor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl Add for Hex {
|
||||||
|
type Output = Hex;
|
||||||
|
|
||||||
|
fn add(self, rhs: Self) -> Self::Output {
|
||||||
|
Hex::new(self.q + rhs.q, self.r + rhs.r, self.s + rhs.s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ impl AppHexGrid {
|
|||||||
let movable_root =
|
let movable_root =
|
||||||
Spatial::create(client.get_root(), Transform::identity(), false).unwrap();
|
Spatial::create(client.get_root(), Transform::identity(), false).unwrap();
|
||||||
|
|
||||||
let button = CenterButton::new(client, &client.get_state()).unwrap();
|
let button = CenterButton::new(client, client.get_state()).unwrap();
|
||||||
tokio::time::sleep(Duration::from_millis(10)).await; // give it a bit of time to send the messages properly
|
tokio::time::sleep(Duration::from_millis(10)).await; // give it a bit of time to send the messages properly
|
||||||
|
|
||||||
let mut desktop_files: Vec<DesktopFile> = get_desktop_files()
|
let mut desktop_files: Vec<DesktopFile> = get_desktop_files()
|
||||||
@@ -89,7 +89,7 @@ impl AppHexGrid {
|
|||||||
let mut apps = Vec::new();
|
let mut apps = Vec::new();
|
||||||
let mut radius = 1;
|
let mut radius = 1;
|
||||||
while !desktop_files.is_empty() {
|
while !desktop_files.is_empty() {
|
||||||
let mut hex = HEX_CENTER.add(&HEX_DIRECTION_VECTORS[4].clone().scale(radius));
|
let mut hex = HEX_CENTER + HEX_DIRECTION_VECTORS[4].scale(radius);
|
||||||
for i in 0..6 {
|
for i in 0..6 {
|
||||||
if desktop_files.is_empty() {
|
if desktop_files.is_empty() {
|
||||||
break;
|
break;
|
||||||
@@ -187,7 +187,7 @@ impl CenterButton {
|
|||||||
let grabbable = Grabbable::create(
|
let grabbable = Grabbable::create(
|
||||||
client.get_root(),
|
client.get_root(),
|
||||||
Transform::none(),
|
Transform::none(),
|
||||||
&button.touch_plane().field(),
|
button.touch_plane().field(),
|
||||||
GrabbableSettings {
|
GrabbableSettings {
|
||||||
max_distance: 0.025,
|
max_distance: 0.025,
|
||||||
pointer_mode: PointerMode::Align,
|
pointer_mode: PointerMode::Align,
|
||||||
@@ -224,7 +224,7 @@ impl CenterButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn frame(&mut self, info: &FrameInfo) {
|
fn frame(&mut self, info: &FrameInfo) {
|
||||||
let _ = self.grabbable.update(&info);
|
let _ = self.grabbable.update(info);
|
||||||
self.button.update();
|
self.button.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ fn get_data_dirs() -> Vec<PathBuf> {
|
|||||||
.split(':')
|
.split(':')
|
||||||
.filter_map(|dir| PathBuf::from_str(dir).ok())
|
.filter_map(|dir| PathBuf::from_str(dir).ok())
|
||||||
.chain(dirs::home_dir().into_iter().map(|d| d.join(".local/share"))) // $HOME/.local/share
|
.chain(dirs::home_dir().into_iter().map(|d| d.join(".local/share"))) // $HOME/.local/share
|
||||||
.chain(PathBuf::from_str("/usr/share").into_iter()) // /usr/share
|
.chain(PathBuf::from_str("/usr/share")) // /usr/share
|
||||||
.chain(PathBuf::from_str("/usr/local/share").into_iter()) // /usr/local/share
|
.chain(PathBuf::from_str("/usr/local/share")) // /usr/local/share
|
||||||
.filter(|dir| dir.exists() && dir.is_dir())
|
.filter(|dir| dir.exists() && dir.is_dir())
|
||||||
.unique()
|
.unique()
|
||||||
.collect()
|
.collect()
|
||||||
@@ -214,9 +214,7 @@ const ICON_SIZES: [u16; 7] = [512, 256, 128, 64, 48, 32, 24];
|
|||||||
impl DesktopFile {
|
impl DesktopFile {
|
||||||
pub fn get_icon(&self, preferred_px_size: u16) -> Option<Icon> {
|
pub fn get_icon(&self, preferred_px_size: u16) -> Option<Icon> {
|
||||||
// Get the name of the icon from the DesktopFile struct
|
// Get the name of the icon from the DesktopFile struct
|
||||||
let Some(icon_name) = self.icon.as_ref() else {
|
let icon_name = self.icon.as_ref()?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
let test_icon_path = self.path.join(Path::new(icon_name));
|
let test_icon_path = self.path.join(Path::new(icon_name));
|
||||||
if test_icon_path.exists() {
|
if test_icon_path.exists() {
|
||||||
if let Some(icon) = Icon::from_path(test_icon_path, preferred_px_size) {
|
if let Some(icon) = Icon::from_path(test_icon_path, preferred_px_size) {
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn frame(&mut self, info: &FrameInfo) {
|
fn frame(&mut self, info: &FrameInfo) {
|
||||||
let _ = self.grabbable.update(&info);
|
let _ = self.grabbable.update(info);
|
||||||
|
|
||||||
if let Some(grabbable_move) = &mut self.grabbable_move {
|
if let Some(grabbable_move) = &mut self.grabbable_move {
|
||||||
if !grabbable_move.is_finished() {
|
if !grabbable_move.is_finished() {
|
||||||
|
|||||||
Reference in New Issue
Block a user