Skip to content

Commit

Permalink
Merge pull request #1 from deepgram-devs/mlodato517-fix-clippy-lints
Browse files Browse the repository at this point in the history
Fix `clippy` lints
  • Loading branch information
Mark Lodato committed May 6, 2022
2 parents 37274a1 + 12775ea commit 742dd7d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn spawn_enemy(mut commands: Commands) {
commands
.spawn_bundle(SpriteBundle {
sprite: Sprite {
color: Color::rgb(0.75, 0.75, 0.75).into(),
color: Color::rgb(0.75, 0.75, 0.75),
custom_size: Some(Vec2::new(
ENEMY_HALF_EXTENDS * 2.0,
ENEMY_HALF_EXTENDS * 2.0,
Expand Down Expand Up @@ -168,13 +168,10 @@ fn keyboard_input(keys: Res<Input<KeyCode>>, mut query: Query<&mut Velocity, Wit
/// Deepgram currently does not support f32 PCM.
fn f32_to_i16(sample: f32) -> i16 {
let sample = sample * 32768.0;
if sample > 32767.0 {
return 32767;
}
if sample < -32768.0 {
return -32768;
}
return sample as i16;

// This is a saturating cast. For more details, see:
// <https://doc.rust-lang.org/reference/expressions/operator-expr.html#numeric-cast>.
sample as i16
}

/// This async function must be executed in an async runtime, and it will return a websocket handle
Expand Down

0 comments on commit 742dd7d

Please sign in to comment.