mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 08:41:34 +11:00
satisfy linter
This commit is contained in:
parent
8d0c50b37a
commit
713791b3fe
|
@ -36,7 +36,9 @@ impl<const S: usize> Arena<S> {
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.for_each(|(index, e)| *e = Element::Next(index as Index + 1));
|
.for_each(|(index, e)| *e = Element::Next(index as Index + 1));
|
||||||
arena.last_mut().map(|a| *a = Element::Next(u8::MAX));
|
if let Some(a) = arena.last_mut() {
|
||||||
|
*a = Element::Next(u8::MAX);
|
||||||
|
}
|
||||||
Arena {
|
Arena {
|
||||||
arena_inner: RefCell::new(ArenaInner { arena, first: 0 }),
|
arena_inner: RefCell::new(ArenaInner { arena, first: 0 }),
|
||||||
}
|
}
|
||||||
|
@ -101,7 +103,6 @@ impl<const S: usize> Clone for Loan<'_, S> {
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use alloc;
|
|
||||||
|
|
||||||
#[test_case]
|
#[test_case]
|
||||||
fn size_of_element(_gba: &mut crate::Gba) {
|
fn size_of_element(_gba: &mut crate::Gba) {
|
||||||
|
@ -113,26 +114,26 @@ mod tests {
|
||||||
fn get_everything(_gba: &mut crate::Gba) {
|
fn get_everything(_gba: &mut crate::Gba) {
|
||||||
let s: Arena<4> = Arena::new();
|
let s: Arena<4> = Arena::new();
|
||||||
{
|
{
|
||||||
let mut c = alloc::vec::Vec::new();
|
let c = alloc::vec![s.get_next_free(), s.get_next_free()];
|
||||||
c.push(s.get_next_free());
|
|
||||||
c.push(s.get_next_free());
|
|
||||||
c.iter().for_each(|a| assert!(a.is_some()));
|
c.iter().for_each(|a| assert!(a.is_some()));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
let mut c = alloc::vec::Vec::new();
|
let c = alloc::vec![
|
||||||
c.push(s.get_next_free());
|
s.get_next_free(),
|
||||||
c.push(s.get_next_free());
|
s.get_next_free(),
|
||||||
c.push(s.get_next_free());
|
s.get_next_free(),
|
||||||
c.push(s.get_next_free());
|
s.get_next_free()
|
||||||
|
];
|
||||||
c.iter().for_each(|a| assert!(a.is_some()));
|
c.iter().for_each(|a| assert!(a.is_some()));
|
||||||
assert!(s.get_next_free().is_none());
|
assert!(s.get_next_free().is_none());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
let mut c = alloc::vec::Vec::new();
|
let c = alloc::vec![
|
||||||
c.push(s.get_next_free());
|
s.get_next_free(),
|
||||||
c.push(s.get_next_free());
|
s.get_next_free(),
|
||||||
c.push(s.get_next_free());
|
s.get_next_free(),
|
||||||
c.push(s.get_next_free());
|
s.get_next_free()
|
||||||
|
];
|
||||||
c.iter().for_each(|a| assert!(a.is_some()));
|
c.iter().for_each(|a| assert!(a.is_some()));
|
||||||
assert!(s.get_next_free().is_none());
|
assert!(s.get_next_free().is_none());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue