diff options
author | metamuffin <metamuffin@disroot.org> | 2025-02-25 21:57:49 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-02-25 21:57:49 +0100 |
commit | b51a9ef2d091dfac4833100e9835471e365168e1 (patch) | |
tree | 6855f9f2c7116cd3fc4ecd1774f3a2f42157c1c2 | |
parent | 6df8b23ffc7ff248dc9fe5d3d8c4ee60abbab022 (diff) | |
download | weareserver-b51a9ef2d091dfac4833100e9835471e365168e1.tar weareserver-b51a9ef2d091dfac4833100e9835471e365168e1.tar.bz2 weareserver-b51a9ef2d091dfac4833100e9835471e365168e1.tar.zst |
clippy
-rw-r--r-- | client/src/chat.rs | 6 | ||||
-rw-r--r-- | world/src/animation.rs | 7 | ||||
-rw-r--r-- | world/src/main.rs | 8 | ||||
-rw-r--r-- | world/src/physics.rs | 6 | ||||
-rw-r--r-- | world/src/vrm.rs | 7 |
5 files changed, 17 insertions, 17 deletions
diff --git a/client/src/chat.rs b/client/src/chat.rs index e5580f5..d60c118 100644 --- a/client/src/chat.rs +++ b/client/src/chat.rs @@ -22,6 +22,12 @@ pub struct Chat { pub send_queue: VecDeque<String>, pub history: VecDeque<String>, } +impl Default for Chat { + fn default() -> Self { + Self::new() + } +} + impl Chat { pub fn new() -> Self { Self { diff --git a/world/src/animation.rs b/world/src/animation.rs index ee6028e..54ce388 100644 --- a/world/src/animation.rs +++ b/world/src/animation.rs @@ -30,8 +30,8 @@ use weareshared::{ store::ResourceStore, }; -pub fn import_animation<'a>( - a: Animation<'a>, +pub fn import_animation( + a: Animation<'_>, store: &ResourceStore, transform: Affine3A, joint_index_to_ibm: &BTreeMap<usize, Affine3A>, @@ -62,8 +62,7 @@ pub fn import_animation<'a>( .into_f32() .map(Quat::from_array) .map(|q| rot.mul_quat(q)) - .map(|q| q.to_array()) - .flatten() + .flat_map(|q| q.to_array()) .collect(), ReadOutputs::Scales(iter) => iter .flat_map(|[x, y, z]| (t.matrix3 * vec3a(x, y, z)).to_array()) diff --git a/world/src/main.rs b/world/src/main.rs index 695b4aa..1a75a61 100644 --- a/world/src/main.rs +++ b/world/src/main.rs @@ -185,11 +185,7 @@ fn main() -> Result<()> { .reader(|buf| Some(&buffers[buf.index()])) .read_inverse_bind_matrices(); for (j_ind, j) in skin.joints().enumerate() { - let ibm = if let Some(x) = &mut inverse_bind_mat { - Some(x.next().unwrap()) - } else { - None - }; + let ibm = inverse_bind_mat.as_mut().map(|x| x.next().unwrap()); let a_ind = match joint_index_to_arm_index.get(&j.index()) { Some(i) => *i, None => { @@ -220,7 +216,7 @@ fn main() -> Result<()> { .enumerate() .map(|(i, p)| { p.and_then(|i| joint_index_to_arm_index.get(&i).copied()) - .unwrap_or_else(|| i) as u16 + .unwrap_or(i) as u16 }) .collect::<Vec<_>>(); diff --git a/world/src/physics.rs b/world/src/physics.rs index 202c4e0..3beb49b 100644 --- a/world/src/physics.rs +++ b/world/src/physics.rs @@ -61,8 +61,10 @@ pub fn import_physics( .map(|[x, y, z]| vec3a(x, y, z)) .collect::<Vec<_>>(); - let mut collpart = CollisionPart::default(); - collpart.name = node.name().map(|s| s.to_string()); + let mut collpart = CollisionPart { + name: node.name().map(|s| s.to_string()), + ..Default::default() + }; if chull { debug!("convex hull has {} positions", position.len()); diff --git a/world/src/vrm.rs b/world/src/vrm.rs index c408b1d..f014e66 100644 --- a/world/src/vrm.rs +++ b/world/src/vrm.rs @@ -51,11 +51,8 @@ pub fn extract_vrm_data(gltf: &Gltf) -> Result<VrmInfo> { o.camera_mount = fp.first_person_bone; o.camera_mount_offset = fp.first_person_bone_offset.map(convert_vrm_vec); for ann in fp.mesh_annotations { - match ann.first_person_flag { - FirstPersonFlag::ThirdPersonOnly => { - o.hide_first_person.insert(ann.node); - } - _ => (), + if let FirstPersonFlag::ThirdPersonOnly = ann.first_person_flag { + o.hide_first_person.insert(ann.node); } } } |