From c4719a5ce0e1bcf15bd7adc9f89ebb234df3e59d Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Mon, 27 May 2024 13:24:58 +0100 Subject: [PATCH] Remove unsafe from examples --- agb/examples/dma_effect_background_colour.rs | 10 ++++------ agb/examples/dma_effect_background_scroll.rs | 3 +-- agb/examples/dma_effect_circular_window.rs | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/agb/examples/dma_effect_background_colour.rs b/agb/examples/dma_effect_background_colour.rs index f7386c59..7d1cfed1 100644 --- a/agb/examples/dma_effect_background_colour.rs +++ b/agb/examples/dma_effect_background_colour.rs @@ -37,12 +37,10 @@ fn main(mut gba: agb::Gba) -> ! { .expect("Should contain colour 0x732b"); loop { - let _background_color_transfer = unsafe { - dma.hblank_transfer( - &vram.background_palette_colour_dma(0, background_colour_index), - &colours, - ) - }; + let _background_color_transfer = dma.hblank_transfer( + &vram.background_palette_colour_dma(0, background_colour_index), + &colours, + ); vblank.wait_for_vblank(); } diff --git a/agb/examples/dma_effect_background_scroll.rs b/agb/examples/dma_effect_background_scroll.rs index eb5cdfaa..a74243ce 100644 --- a/agb/examples/dma_effect_background_scroll.rs +++ b/agb/examples/dma_effect_background_scroll.rs @@ -34,8 +34,7 @@ fn main(mut gba: agb::Gba) -> ! { let mut frame = 0; loop { - let _x_scroll_transfer = - unsafe { dma.hblank_transfer(&map.x_scroll_dma(), &offsets[frame..]) }; + let _x_scroll_transfer = dma.hblank_transfer(&map.x_scroll_dma(), &offsets[frame..]); vblank.wait_for_vblank(); frame += 1; diff --git a/agb/examples/dma_effect_circular_window.rs b/agb/examples/dma_effect_circular_window.rs index d98e6f60..cbdf8285 100644 --- a/agb/examples/dma_effect_circular_window.rs +++ b/agb/examples/dma_effect_circular_window.rs @@ -90,7 +90,7 @@ fn main(mut gba: agb::Gba) -> ! { window.commit(); let dma_controllable = window.win_in(WinIn::Win0).horizontal_position_dma(); - let _transfer = unsafe { dmas.dma0.hblank_transfer(&dma_controllable, &circle_poses) }; + let _transfer = dmas.dma0.hblank_transfer(&dma_controllable, &circle_poses); vblank.wait_for_vblank(); }