mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Fix clippy and use nightly for CI builds (#540)
This commit is contained in:
commit
156fe0fe7d
3
.github/workflows/build-and-test.yml
vendored
3
.github/workflows/build-and-test.yml
vendored
|
@ -10,7 +10,8 @@ on:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
RUSTUP_TOOLCHAIN: ${{ !github.event.schedule && 'nightly-2023-12-01' || 'nightly' }}
|
# RUSTUP_TOOLCHAIN: ${{ !github.event.schedule && 'nightly-2023-12-01' || 'nightly' }}
|
||||||
|
RUSTUP_TOOLCHAIN: "nightly"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
100
.vscode/agb.code-workspace
vendored
100
.vscode/agb.code-workspace
vendored
|
@ -1,49 +1,55 @@
|
||||||
{
|
{
|
||||||
"folders": [
|
"folders": [
|
||||||
{
|
{
|
||||||
"path": "../agb"
|
"path": "../agb"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../agb-sound-converter"
|
"path": "../agb-sound-converter"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../agb-macros"
|
"path": "../agb-macros"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../agb-image-converter"
|
"path": "../agb-image-converter"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../agb-fixnum"
|
"path": "../agb-fixnum"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../examples/the-purple-night"
|
"path": "../examples/the-purple-night"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../examples/the-hat-chooses-the-wizard"
|
"path": "../examples/the-hat-chooses-the-wizard"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../examples/hyperspace-roll"
|
"path": "../examples/hyperspace-roll"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../.github"
|
"path": "../.github"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../template"
|
"path": "../template"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../book"
|
"path": "../book"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../mgba-test-runner"
|
"path": "../mgba-test-runner"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../tools"
|
"path": "../tools"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../examples/combo"
|
"path": "../examples/combo"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../agb-hashmap"
|
"path": "../agb-hashmap"
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
"path": "../examples/amplitude"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../examples/the-dungeon-puzzlers-lament"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
|
@ -387,6 +387,8 @@ pub(crate) fn program_counter_before_interrupt() -> u32 {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
use core::ptr::addr_of_mut;
|
||||||
|
|
||||||
use super::Gba;
|
use super::Gba;
|
||||||
|
|
||||||
#[test_case]
|
#[test_case]
|
||||||
|
@ -415,11 +417,11 @@ mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[link_section = ".ewram"]
|
#[link_section = ".ewram"]
|
||||||
static mut EWRAM_TEST: u32 = 5;
|
static mut EWART_TEST: u32 = 5;
|
||||||
#[test_case]
|
#[test_case]
|
||||||
fn ewram_static_test(_gba: &mut Gba) {
|
fn ewram_static_test(_gba: &mut Gba) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ewram_ptr = &mut EWRAM_TEST as *mut u32;
|
let ewram_ptr = addr_of_mut!(EWART_TEST);
|
||||||
let content = ewram_ptr.read_volatile();
|
let content = ewram_ptr.read_volatile();
|
||||||
assert_eq!(content, 5, "expected data in ewram to be 5");
|
assert_eq!(content, 5, "expected data in ewram to be 5");
|
||||||
ewram_ptr.write_volatile(content + 1);
|
ewram_ptr.write_volatile(content + 1);
|
||||||
|
@ -438,7 +440,7 @@ mod test {
|
||||||
#[test_case]
|
#[test_case]
|
||||||
fn iwram_explicit_test(_gba: &mut Gba) {
|
fn iwram_explicit_test(_gba: &mut Gba) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let iwram_ptr = &mut IWRAM_EXPLICIT as *mut u32;
|
let iwram_ptr = addr_of_mut!(IWRAM_EXPLICIT);
|
||||||
let address = iwram_ptr as usize;
|
let address = iwram_ptr as usize;
|
||||||
assert!(
|
assert!(
|
||||||
(0x0300_0000..0x0300_8000).contains(&address),
|
(0x0300_0000..0x0300_8000).contains(&address),
|
||||||
|
@ -456,7 +458,7 @@ mod test {
|
||||||
#[test_case]
|
#[test_case]
|
||||||
fn implicit_data_test(_gba: &mut Gba) {
|
fn implicit_data_test(_gba: &mut Gba) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let iwram_ptr = &mut IMPLICIT_STORAGE as *mut u32;
|
let iwram_ptr = addr_of_mut!(IMPLICIT_STORAGE);
|
||||||
let address = iwram_ptr as usize;
|
let address = iwram_ptr as usize;
|
||||||
assert!(
|
assert!(
|
||||||
(0x0200_0000..0x0204_0000).contains(&address),
|
(0x0200_0000..0x0204_0000).contains(&address),
|
||||||
|
|
|
@ -243,7 +243,7 @@ static CHIP_INFO: InitOnce<&'static ChipInfo> = InitOnce::new();
|
||||||
fn cached_chip_info() -> Result<&'static ChipInfo, Error> {
|
fn cached_chip_info() -> Result<&'static ChipInfo, Error> {
|
||||||
CHIP_INFO
|
CHIP_INFO
|
||||||
.try_get(|| -> Result<_, Error> { Ok(FlashChipType::detect()?.chip_info()) })
|
.try_get(|| -> Result<_, Error> { Ok(FlashChipType::detect()?.chip_info()) })
|
||||||
.map(Clone::clone)
|
.cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Actual implementation of the ChipInfo functions.
|
/// Actual implementation of the ChipInfo functions.
|
||||||
|
|
|
@ -186,7 +186,7 @@ struct Game {
|
||||||
|
|
||||||
enum GameState {
|
enum GameState {
|
||||||
Continue,
|
Continue,
|
||||||
Loss(u32),
|
Loss,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Game {
|
impl Game {
|
||||||
|
@ -314,7 +314,7 @@ impl Game {
|
||||||
|| (self.head_position.y + 1).floor() > display::HEIGHT + 4;
|
|| (self.head_position.y + 1).floor() > display::HEIGHT + 4;
|
||||||
|
|
||||||
if saw_has_hit_head || out_of_bounds_death {
|
if saw_has_hit_head || out_of_bounds_death {
|
||||||
GameState::Loss(self.alive_frames)
|
GameState::Loss
|
||||||
} else {
|
} else {
|
||||||
GameState::Continue
|
GameState::Continue
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ pub fn main(mut gba: agb::Gba) -> ! {
|
||||||
|
|
||||||
game.render(oam_frame, &sprite_cache);
|
game.render(oam_frame, &sprite_cache);
|
||||||
|
|
||||||
if let GameState::Loss(_) = state {
|
if matches!(state, GameState::Loss) {
|
||||||
for _ in 0..30 {
|
for _ in 0..30 {
|
||||||
vblank.wait_for_vblank();
|
vblank.wait_for_vblank();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1074,6 +1074,9 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
// allow dead code because field is unused apart from in a debug string,
|
||||||
|
// which is what we want to use it for.
|
||||||
|
#[allow(dead_code)]
|
||||||
enum CompleteSimulationResult {
|
enum CompleteSimulationResult {
|
||||||
Success,
|
Success,
|
||||||
ExplicitLoss,
|
ExplicitLoss,
|
||||||
|
|
Loading…
Reference in a new issue