Add boards/ && clippy
This commit is contained in:
parent
26bc01f3bc
commit
60143939d4
20 changed files with 89 additions and 89 deletions
|
@ -31,7 +31,7 @@ impl RecycleAllocator {
|
|||
pub fn dealloc(&mut self, id: usize) {
|
||||
assert!(id < self.current);
|
||||
assert!(
|
||||
self.recycled.iter().find(|i| **i == id).is_none(),
|
||||
!self.recycled.iter().any(|i| *i == id),
|
||||
"id {} has been deallocated!",
|
||||
id
|
||||
);
|
||||
|
|
|
@ -40,7 +40,7 @@ pub fn fetch_task() -> Option<Arc<TaskControlBlock>> {
|
|||
|
||||
pub fn pid2process(pid: usize) -> Option<Arc<ProcessControlBlock>> {
|
||||
let map = PID2PCB.exclusive_access();
|
||||
map.get(&pid).map(|task| Arc::clone(task))
|
||||
map.get(&pid).map(Arc::clone)
|
||||
}
|
||||
|
||||
pub fn insert_into_pid2process(pid: usize, process: Arc<ProcessControlBlock>) {
|
||||
|
|
|
@ -5,6 +5,7 @@ mod process;
|
|||
mod processor;
|
||||
mod signal;
|
||||
mod switch;
|
||||
#[allow(clippy::module_inception)]
|
||||
mod task;
|
||||
|
||||
use crate::fs::{open_file, OpenFlags};
|
||||
|
|
|
@ -25,7 +25,7 @@ impl Processor {
|
|||
self.current.take()
|
||||
}
|
||||
pub fn current(&self) -> Option<Arc<TaskControlBlock>> {
|
||||
self.current.as_ref().map(|task| Arc::clone(task))
|
||||
self.current.as_ref().map(Arc::clone)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,7 @@ pub fn current_process() -> Arc<ProcessControlBlock> {
|
|||
|
||||
pub fn current_user_token() -> usize {
|
||||
let task = current_task().unwrap();
|
||||
let token = task.get_user_token();
|
||||
token
|
||||
task.get_user_token()
|
||||
}
|
||||
|
||||
pub fn current_trap_cx() -> &'static mut TrapContext {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue