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:
|
||||
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:
|
||||
build:
|
||||
|
|
102
.vscode/agb.code-workspace
vendored
102
.vscode/agb.code-workspace
vendored
|
@ -1,49 +1,55 @@
|
|||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "../agb"
|
||||
},
|
||||
{
|
||||
"path": "../agb-sound-converter"
|
||||
},
|
||||
{
|
||||
"path": "../agb-macros"
|
||||
},
|
||||
{
|
||||
"path": "../agb-image-converter"
|
||||
},
|
||||
{
|
||||
"path": "../agb-fixnum"
|
||||
},
|
||||
{
|
||||
"path": "../examples/the-purple-night"
|
||||
},
|
||||
{
|
||||
"path": "../examples/the-hat-chooses-the-wizard"
|
||||
},
|
||||
{
|
||||
"path": "../examples/hyperspace-roll"
|
||||
},
|
||||
{
|
||||
"path": "../.github"
|
||||
},
|
||||
{
|
||||
"path": "../template"
|
||||
},
|
||||
{
|
||||
"path": "../book"
|
||||
},
|
||||
{
|
||||
"path": "../mgba-test-runner"
|
||||
},
|
||||
{
|
||||
"path": "../tools"
|
||||
},
|
||||
{
|
||||
"path": "../examples/combo"
|
||||
},
|
||||
{
|
||||
"path": "../agb-hashmap"
|
||||
}
|
||||
]
|
||||
}
|
||||
"folders": [
|
||||
{
|
||||
"path": "../agb"
|
||||
},
|
||||
{
|
||||
"path": "../agb-sound-converter"
|
||||
},
|
||||
{
|
||||
"path": "../agb-macros"
|
||||
},
|
||||
{
|
||||
"path": "../agb-image-converter"
|
||||
},
|
||||
{
|
||||
"path": "../agb-fixnum"
|
||||
},
|
||||
{
|
||||
"path": "../examples/the-purple-night"
|
||||
},
|
||||
{
|
||||
"path": "../examples/the-hat-chooses-the-wizard"
|
||||
},
|
||||
{
|
||||
"path": "../examples/hyperspace-roll"
|
||||
},
|
||||
{
|
||||
"path": "../.github"
|
||||
},
|
||||
{
|
||||
"path": "../template"
|
||||
},
|
||||
{
|
||||
"path": "../book"
|
||||
},
|
||||
{
|
||||
"path": "../mgba-test-runner"
|
||||
},
|
||||
{
|
||||
"path": "../tools"
|
||||
},
|
||||
{
|
||||
"path": "../examples/combo"
|
||||
},
|
||||
{
|
||||
"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)]
|
||||
mod test {
|
||||
use core::ptr::addr_of_mut;
|
||||
|
||||
use super::Gba;
|
||||
|
||||
#[test_case]
|
||||
|
@ -415,11 +417,11 @@ mod test {
|
|||
}
|
||||
|
||||
#[link_section = ".ewram"]
|
||||
static mut EWRAM_TEST: u32 = 5;
|
||||
static mut EWART_TEST: u32 = 5;
|
||||
#[test_case]
|
||||
fn ewram_static_test(_gba: &mut Gba) {
|
||||
unsafe {
|
||||
let ewram_ptr = &mut EWRAM_TEST as *mut u32;
|
||||
let ewram_ptr = addr_of_mut!(EWART_TEST);
|
||||
let content = ewram_ptr.read_volatile();
|
||||
assert_eq!(content, 5, "expected data in ewram to be 5");
|
||||
ewram_ptr.write_volatile(content + 1);
|
||||
|
@ -438,7 +440,7 @@ mod test {
|
|||
#[test_case]
|
||||
fn iwram_explicit_test(_gba: &mut Gba) {
|
||||
unsafe {
|
||||
let iwram_ptr = &mut IWRAM_EXPLICIT as *mut u32;
|
||||
let iwram_ptr = addr_of_mut!(IWRAM_EXPLICIT);
|
||||
let address = iwram_ptr as usize;
|
||||
assert!(
|
||||
(0x0300_0000..0x0300_8000).contains(&address),
|
||||
|
@ -456,7 +458,7 @@ mod test {
|
|||
#[test_case]
|
||||
fn implicit_data_test(_gba: &mut Gba) {
|
||||
unsafe {
|
||||
let iwram_ptr = &mut IMPLICIT_STORAGE as *mut u32;
|
||||
let iwram_ptr = addr_of_mut!(IMPLICIT_STORAGE);
|
||||
let address = iwram_ptr as usize;
|
||||
assert!(
|
||||
(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> {
|
||||
CHIP_INFO
|
||||
.try_get(|| -> Result<_, Error> { Ok(FlashChipType::detect()?.chip_info()) })
|
||||
.map(Clone::clone)
|
||||
.cloned()
|
||||
}
|
||||
|
||||
/// Actual implementation of the ChipInfo functions.
|
||||
|
|
|
@ -186,7 +186,7 @@ struct Game {
|
|||
|
||||
enum GameState {
|
||||
Continue,
|
||||
Loss(u32),
|
||||
Loss,
|
||||
}
|
||||
|
||||
impl Game {
|
||||
|
@ -314,7 +314,7 @@ impl Game {
|
|||
|| (self.head_position.y + 1).floor() > display::HEIGHT + 4;
|
||||
|
||||
if saw_has_hit_head || out_of_bounds_death {
|
||||
GameState::Loss(self.alive_frames)
|
||||
GameState::Loss
|
||||
} else {
|
||||
GameState::Continue
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ pub fn main(mut gba: agb::Gba) -> ! {
|
|||
|
||||
game.render(oam_frame, &sprite_cache);
|
||||
|
||||
if let GameState::Loss(_) = state {
|
||||
if matches!(state, GameState::Loss) {
|
||||
for _ in 0..30 {
|
||||
vblank.wait_for_vblank();
|
||||
}
|
||||
|
|
|
@ -1074,6 +1074,9 @@ mod tests {
|
|||
}
|
||||
|
||||
#[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 {
|
||||
Success,
|
||||
ExplicitLoss,
|
||||
|
|
Loading…
Reference in a new issue