Skip to content
This repository has been archived by the owner on Apr 18, 2022. It is now read-only.

Commit

Permalink
Merge #2349
Browse files Browse the repository at this point in the history
2349: Update book example pong-tutorial-06 to fix clippy warning r=CleanCut a=MrTanoshii

## Description

Clippy will warn of https://rust-lang.github.io/rust-clippy/master/index.html#option_as_ref_deref
The examples were already fixed by #2181 but the book was not.

## Additions

N/A

## Removals

N/A

## Modifications

N/A

## PR Checklist

By placing an x in the boxes I certify that I have:

- [x] Updated the content of the book if this PR would make the book outdated.
- [ ] Added a changelog entry if this will impact users, or modified more than 5 lines of Rust that wasn't a doc comment.
- [ ] Added unit tests for new code added in this PR.
- [x] Acknowledged that by making this pull request I release this code under an MIT/Apache 2.0 dual licensing scheme.

If this modified or created any rs files:

- [x] Ran `cargo +stable fmt --all`
- [x] Ran `cargo clippy --all --features "empty"`
- [x] Ran `cargo test --all --features "empty"`


Co-authored-by: MrTanoshii <47116127+MrTanoshii@users.noreply.github.com>
  • Loading branch information
bors[bot] and MrTanoshii committed Jul 7, 2020
2 parents c52a21d + 3fce703 commit f19ab3a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions book/src/pong-tutorial/pong-tutorial-06.md
Expand Up @@ -122,7 +122,6 @@ pub fn play_bounce_sound(sounds: &Sounds, storage: &AssetStorage<Source>, output
Then, we'll update the Bounce System to play the sound whenever the ball bounces. Update `systems/bounce.rs`:

```rust,ignore
use std::ops::Deref;
use amethyst::{
assets::AssetStorage,
Expand Down Expand Up @@ -154,7 +153,7 @@ impl<'s> System<'s> for BounceSystem {
|| (ball_y >= ARENA_HEIGHT - ball.radius && ball.velocity[1] > 0.0)
{
ball.velocity[1] = -ball.velocity[1];
play_bounce_sound(&*sounds, &storage, audio_output.as_ref().map(|o| o.deref()));
play_bounce_sound(&*sounds, &storage, audio_output.as_deref());
}
// Bounce at the paddles.
Expand All @@ -168,7 +167,7 @@ impl<'s> System<'s> for BounceSystem {
|| (paddle.side == Side::Right && ball.velocity[0] > 0.0)
{
ball.velocity[0] = -ball.velocity[0];
play_bounce_sound(&*sounds, &storage, audio_output.as_ref().map(|o| o.deref()));
play_bounce_sound(&*sounds, &storage, audio_output.as_deref());
}
}
}
Expand Down Expand Up @@ -214,7 +213,6 @@ use amethyst::{
ecs::Read,
};
use crate::audio::{play_score_sound, Sounds};
use std::ops::Deref;
impl<'s> System<'s> for WinnerSystem {
type SystemData = (
Expand Down Expand Up @@ -247,7 +245,7 @@ impl<'s> System<'s> for WinnerSystem {
transform.set_translation_x(ARENA_WIDTH / 2.0); // Reset Position
transform.set_translation_y(ARENA_HEIGHT / 2.0); // Reset Position
play_score_sound(&*sounds, &storage, audio_output.as_ref().map(|o| o.deref()));
play_score_sound(&*sounds, &storage, audio_output.as_deref());
// Print the scoreboard.
println!(
Expand Down

0 comments on commit f19ab3a

Please sign in to comment.