mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Fix clippy lint and fmt in the emulator
This commit is contained in:
parent
52ddd97a2e
commit
08ad8765de
|
@ -15,7 +15,6 @@ pub enum LogLevel {
|
||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
#[error("A log level of {provided_log_level} does not match any known log level")]
|
#[error("A log level of {provided_log_level} does not match any known log level")]
|
||||||
pub struct LogLevelIsNotValid {
|
pub struct LogLevelIsNotValid {
|
||||||
|
@ -34,9 +33,11 @@ impl TryFrom<mgba_sys::mLogLevel> for LogLevel {
|
||||||
mgba_sys::mLogLevel_mLOG_DEBUG => LogLevel::Debug,
|
mgba_sys::mLogLevel_mLOG_DEBUG => LogLevel::Debug,
|
||||||
mgba_sys::mLogLevel_mLOG_STUB => LogLevel::Stub,
|
mgba_sys::mLogLevel_mLOG_STUB => LogLevel::Stub,
|
||||||
mgba_sys::mLogLevel_mLOG_GAME_ERROR => LogLevel::GameError,
|
mgba_sys::mLogLevel_mLOG_GAME_ERROR => LogLevel::GameError,
|
||||||
_ => return Err(LogLevelIsNotValid {
|
_ => {
|
||||||
provided_log_level: value
|
return Err(LogLevelIsNotValid {
|
||||||
|
provided_log_level: value,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +96,11 @@ extern "C" fn log_string_wrapper(
|
||||||
unsafe { CStr::from_ptr(category_c_name).to_str() }.unwrap_or(UNKNOWN)
|
unsafe { CStr::from_ptr(category_c_name).to_str() }.unwrap_or(UNKNOWN)
|
||||||
};
|
};
|
||||||
|
|
||||||
logger(category_name, LogLevel::try_from(level).unwrap_or(LogLevel::Unknown), s);
|
logger(
|
||||||
|
category_name,
|
||||||
|
LogLevel::try_from(level).unwrap_or(LogLevel::Unknown),
|
||||||
|
s,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,14 +113,14 @@ impl<V: VFile> VFileAlloc<V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn into_mgba(self) -> *mut mgba_sys::VFile {
|
pub(crate) fn into_mgba(self) -> *mut mgba_sys::VFile {
|
||||||
let f = Box::into_raw(self.0) as *mut VFileInner<V>;
|
let f = Box::into_raw(self.0);
|
||||||
f.cast()
|
f.cast()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod vfile_extern {
|
mod vfile_extern {
|
||||||
use std::io::SeekFrom;
|
|
||||||
use super::VFileExtensions;
|
use super::VFileExtensions;
|
||||||
|
use std::io::SeekFrom;
|
||||||
|
|
||||||
/// Safety: Must be part of a VFileInner
|
/// Safety: Must be part of a VFileInner
|
||||||
pub unsafe fn create_vfile<V: super::VFile>() -> mgba_sys::VFile {
|
pub unsafe fn create_vfile<V: super::VFile>() -> mgba_sys::VFile {
|
||||||
|
|
Loading…
Reference in a new issue