mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-17 12:47:16 +00:00
Fix Rust format and lint issues
This commit is contained in:
parent
51c918c3fc
commit
bfd7497b25
10
Makefile
10
Makefile
@ -9,12 +9,14 @@ test: build
|
|||||||
@cd src && cargo test
|
@cd src && cargo test
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
@cd src && cargo doc
|
@cd src && cargo doc # Build Rust docs
|
||||||
@echo "" # Add a blank line
|
@echo "" # Add a blank line
|
||||||
@cd docs && mdbook build
|
@cd docs && mdbook build # Build mdBook
|
||||||
|
|
||||||
fmt:
|
check:
|
||||||
@cd src && cargo fmt
|
@cd src && cargo check # Check dependency errors
|
||||||
|
@cd src && cargo fmt --check # Check Rust format issues
|
||||||
|
@cd src && cargo clippy # Check common programming mistakes
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@cd src && cargo clean
|
@cd src && cargo clean
|
||||||
|
@ -81,10 +81,12 @@ impl FpRegs {
|
|||||||
|
|
||||||
/// Save the floating state given by a slice of u8.
|
/// Save the floating state given by a slice of u8.
|
||||||
///
|
///
|
||||||
|
/// After calling this method, the state of the instance will be considered valid.
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
/// It is the caller's responsibility to ensure that the source slice contains
|
/// It is the caller's responsibility to ensure that the source slice contains
|
||||||
/// data that is in xsave/xrstor format. The slice must have a length of 512 bytes.
|
/// data that is in xsave/xrstor format. The slice must have a length of 512 bytes.
|
||||||
///
|
|
||||||
/// After calling this method, the state of the instance will be considered valid.
|
|
||||||
pub unsafe fn save_from_slice(&mut self, src: &[u8]) {
|
pub unsafe fn save_from_slice(&mut self, src: &[u8]) {
|
||||||
//(&mut self.buf).copy_from_slice(src);
|
//(&mut self.buf).copy_from_slice(src);
|
||||||
//self.is_valid = true;
|
//self.is_valid = true;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
//! Tasks are the unit of code execution.
|
//! Tasks are the unit of code execution.
|
||||||
|
|
||||||
mod scheduler;
|
mod scheduler;
|
||||||
|
#[allow(clippy::module_inception)]
|
||||||
mod task;
|
mod task;
|
||||||
|
|
||||||
pub use self::scheduler::{set_scheduler, Scheduler};
|
pub use self::scheduler::{set_scheduler, Scheduler};
|
||||||
|
@ -62,6 +62,11 @@ impl VmFrameVec {
|
|||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns whether the frame collection is empty.
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the number of bytes.
|
/// Returns the number of bytes.
|
||||||
///
|
///
|
||||||
/// This method is equivalent to `self.len() * PAGE_SIZE`.
|
/// This method is equivalent to `self.len() * PAGE_SIZE`.
|
||||||
|
@ -24,7 +24,10 @@ pub unsafe trait Pod: Copy + Sized {
|
|||||||
/// Creates a new instance of Pod type with uninitialized content.
|
/// Creates a new instance of Pod type with uninitialized content.
|
||||||
fn new_uninit() -> Self {
|
fn new_uninit() -> Self {
|
||||||
// SAFETY. A value of `T: Pod` can have arbitrary bits.
|
// SAFETY. A value of `T: Pod` can have arbitrary bits.
|
||||||
unsafe { MaybeUninit::uninit().assume_init() }
|
#[allow(clippy::uninit_assumed_init)]
|
||||||
|
unsafe {
|
||||||
|
MaybeUninit::uninit().assume_init()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new instance from the given bytes.
|
/// Creates a new instance from the given bytes.
|
||||||
|
@ -48,6 +48,12 @@ impl VmSpace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for VmSpace {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Options for mapping physical memory pages into a VM address space.
|
/// Options for mapping physical memory pages into a VM address space.
|
||||||
/// See `VmSpace::map`.
|
/// See `VmSpace::map`.
|
||||||
pub struct VmMapOptions {}
|
pub struct VmMapOptions {}
|
||||||
@ -93,6 +99,12 @@ impl VmMapOptions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for VmMapOptions {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
/// Virtual memory protection permissions.
|
/// Virtual memory protection permissions.
|
||||||
pub struct VmPerm: u8 {
|
pub struct VmPerm: u8 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user