Skip to content

Commit

Permalink
chore: more clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
galister committed Apr 15, 2024
1 parent 3d20cd0 commit 27d3bd2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
5 changes: 1 addition & 4 deletions src/core/ext_tracking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ impl ExtTracking {
.and_then(|parameters| parameters.get("FT"))
.and_then(|ft| ft.get("v2"))
.and_then(|v2| {
let Some(contents) = &v2.contents else {
return None;
};
contents.iter().for_each(|(name, node)| {
v2.contents.as_ref()?.iter().for_each(|(name, node)| {
if let Some(m) = FT_PARAMS_REGEX.captures(name) {
let main: Arc<str> = m[1].into();

Expand Down
4 changes: 2 additions & 2 deletions src/core/ext_tracking/unified.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ impl UnifiedTrackingData {
let mut dirty = Vec::new();

if let Some(old_shapes) = self.old_shapes.as_ref() {
for i in 0..NUM_SHAPES {
if (self.shapes[i] - old_shapes[i]).abs() > 0.01 {
for (i, item) in old_shapes.iter().enumerate().take(NUM_SHAPES) {
if (self.shapes[i] - item).abs() > 0.01 {
dirty.push(i);
}
}
Expand Down
17 changes: 7 additions & 10 deletions src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ impl AvatarOsc {
let mut running = true;

loop {
receiver.try_iter().last().map(|x| {
if let Some(x) = receiver.try_iter().last() {
info!("Self-drive: {}", x);
running = x;
});
}
if running {
let _ = lo.send(&[0u8; 1]);
thread::sleep(Duration::from_millis(11));
Expand Down Expand Up @@ -186,14 +186,11 @@ impl AvatarOsc {
autopilot_step(parameters, &self.ext_tracking, &mut bundle);

if let Some(packet) = bundle.content.first() {
match packet {
OscPacket::Message(..) => {
rosc::encoder::encode(packet)
.ok()
.and_then(|buf| self.send_upstream(&buf).ok());
bundle.content.remove(0);
}
_ => {}
if let OscPacket::Message(..) = packet {
rosc::encoder::encode(packet)
.ok()
.and_then(|buf| self.send_upstream(&buf).ok());
bundle.content.remove(0);
}
}

Expand Down

0 comments on commit 27d3bd2

Please sign in to comment.