Fix clippy and use nightly for CI builds (#540)

This commit is contained in:
Corwin 2024-01-13 10:46:06 +00:00 committed by GitHub
commit 156fe0fe7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 69 additions and 57 deletions

View file

@ -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:

View file

@ -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"
}
]
}

View file

@ -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),

View file

@ -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.

View file

@ -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();
}

View file

@ -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,