clippy(all): cleanup

This commit is contained in:
Nova
2024-07-19 09:30:53 -04:00
parent 0b398284e2
commit 39499a061a
6 changed files with 21 additions and 18 deletions

View File

@@ -190,7 +190,7 @@ impl App {
}
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 !grabbable_move.is_finished() {

View File

@@ -1,7 +1,9 @@
use std::ops::Add;
use crate::{APP_SIZE, PADDING};
use tween::TweenTime;
#[derive(Clone)]
#[derive(Clone, Copy, Debug, Default)]
pub struct Hex {
q: isize,
r: isize,
@@ -30,15 +32,18 @@ impl Hex {
[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 {
self.add(&HEX_DIRECTION_VECTORS[direction])
self + HEX_DIRECTION_VECTORS[direction]
}
pub fn scale(self, factor: isize) -> Self {
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)
}
}

View File

@@ -76,7 +76,7 @@ impl AppHexGrid {
let movable_root =
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
let mut desktop_files: Vec<DesktopFile> = get_desktop_files()
@@ -89,7 +89,7 @@ impl AppHexGrid {
let mut apps = Vec::new();
let mut radius = 1;
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 {
if desktop_files.is_empty() {
break;
@@ -187,7 +187,7 @@ impl CenterButton {
let grabbable = Grabbable::create(
client.get_root(),
Transform::none(),
&button.touch_plane().field(),
button.touch_plane().field(),
GrabbableSettings {
max_distance: 0.025,
pointer_mode: PointerMode::Align,
@@ -224,7 +224,7 @@ impl CenterButton {
}
fn frame(&mut self, info: &FrameInfo) {
let _ = self.grabbable.update(&info);
let _ = self.grabbable.update(info);
self.button.update();
}
}