fix more clippy warnings

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-07-29 22:48:48 +08:00
parent 869ebcff8b
commit ef0ef924c8
5 changed files with 13 additions and 13 deletions

View file

@ -202,7 +202,7 @@ fn handle_connection(
); );
msg.buf.addr = msg.buf.addr =
match MemoryAddress::new(Box::into_raw(sliced_data) match MemoryAddress::new(Box::into_raw(sliced_data)
as *mut usize as *mut u8
as usize) as usize)
{ {
Some(a) => a, Some(a) => a,

View file

@ -139,7 +139,7 @@ impl MemoryManager {
for tag in args_iter { for tag in args_iter {
if tag.name == make_type!("MREx") { if tag.name == make_type!("MREx") {
assert!( assert!(
self.extra.len() == 0, self.extra.is_empty(),
"mm: MREx tag appears twice! self.extra.len() is {}, not 0", "mm: MREx tag appears twice! self.extra.len() is {}, not 0",
self.extra.len() self.extra.len()
); );

View file

@ -221,8 +221,8 @@ impl Server {
/// giving it back to the previous process space. /// giving it back to the previous process space.
pub fn discard_messages_for_pid(&mut self, pid: PID) { pub fn discard_messages_for_pid(&mut self, pid: PID) {
for entry in self.queue.iter_mut() { for entry in self.queue.iter_mut() {
match entry { match *entry {
&mut QueuedMessage::MemoryMessageROLend( QueuedMessage::MemoryMessageROLend(
msg_pid, msg_pid,
ctx, ctx,
arg1, arg1,
@ -238,7 +238,7 @@ impl Server {
); );
} }
} }
&mut QueuedMessage::MemoryMessageRWLend( QueuedMessage::MemoryMessageRWLend(
msg_pid, msg_pid,
ctx, ctx,
arg1, arg1,

View file

@ -48,7 +48,7 @@ pub enum ProcessState {
/// This is a brand-new process that hasn't been run yet, and needs its /// This is a brand-new process that hasn't been run yet, and needs its
/// initial context set up. /// initial context set up.
Setup(ThreadInit), // Setup(ThreadInit),
/// This process is able to be run. The context bitmask describes contexts /// This process is able to be run. The context bitmask describes contexts
/// that are ready. /// that are ready.
@ -161,7 +161,7 @@ impl Process {
/// This process has at least one context that may be run /// This process has at least one context that may be run
pub fn runnable(&self) -> bool { pub fn runnable(&self) -> bool {
match self.state { match self.state {
ProcessState::Setup(_) | ProcessState::Ready(_) => true, /*ProcessState::Setup(_) | */ProcessState::Ready(_) => true,
_ => false, _ => false,
} }
} }
@ -517,7 +517,7 @@ impl SystemServices {
process.state = match process.state { process.state = match process.state {
ProcessState::Free => return Err(xous::Error::ProcessNotFound), ProcessState::Free => return Err(xous::Error::ProcessNotFound),
ProcessState::Sleeping => return Err(xous::Error::ProcessNotFound), ProcessState::Sleeping => return Err(xous::Error::ProcessNotFound),
ProcessState::Allocated => return Err(xous::Error::ProcessNotFound), ProcessState::Allocated => return Err(xous::Error::ProcessNotFound),/*
ProcessState::Setup(setup) => { ProcessState::Setup(setup) => {
// Activate the process, which enables its memory mapping // Activate the process, which enables its memory mapping
process.activate()?; process.activate()?;
@ -537,7 +537,7 @@ impl SystemServices {
// Mark the current proces state as "running, and no waiting contexts" // Mark the current proces state as "running, and no waiting contexts"
ProcessState::Running(0) ProcessState::Running(0)
} }*/
ProcessState::Ready(0) => { ProcessState::Ready(0) => {
panic!("ProcessState was `Ready(0)`, which is invalid!"); panic!("ProcessState was `Ready(0)`, which is invalid!");
} }
@ -737,7 +737,7 @@ impl SystemServices {
// Ensure the new process can be run. // Ensure the new process can be run.
match new.state { match new.state {
ProcessState::Free => return Err(xous::Error::ProcessNotFound), ProcessState::Free => return Err(xous::Error::ProcessNotFound),
ProcessState::Setup(_) | ProcessState::Allocated => new_tid = INITIAL_TID, /*ProcessState::Setup(_) | */ProcessState::Allocated => new_tid = INITIAL_TID,
ProcessState::Running(x) | ProcessState::Ready(x) => { ProcessState::Running(x) | ProcessState::Ready(x) => {
// If no new context is specified, take the previous // If no new context is specified, take the previous
// context. If that is not runnable, do a round-robin // context. If that is not runnable, do a round-robin
@ -784,7 +784,7 @@ impl SystemServices {
// Set up the new process, if necessary. Remove the new context from // Set up the new process, if necessary. Remove the new context from
// the list of ready contexts. // the list of ready contexts.
new.state = match new.state { new.state = match new.state {
ProcessState::Setup(_init_context) => { /*ProcessState::Setup(_init_context) => {
// entrypoint, stack, stack_size) => { // entrypoint, stack, stack_size) => {
// let mut process = ProcessHandle::get(); // let mut process = ProcessHandle::get();
// println!( // println!(
@ -803,7 +803,7 @@ impl SystemServices {
// ) // )
// .expect("couldn't reserve stack"); // .expect("couldn't reserve stack");
ProcessState::Running(0) ProcessState::Running(0)
} }*/
ProcessState::Allocated => ProcessState::Running(0), ProcessState::Allocated => ProcessState::Running(0),
ProcessState::Free => panic!("process was suddenly Free"), ProcessState::Free => panic!("process was suddenly Free"),
ProcessState::Ready(x) | ProcessState::Running(x) => { ProcessState::Ready(x) | ProcessState::Running(x) => {

View file

@ -180,7 +180,7 @@ mod process {
eprintln!("couldn't start command: {}", e); eprintln!("couldn't start command: {}", e);
crate::Error::InternalError crate::Error::InternalError
}); });
println!("Process result: {:?}", result); // println!("Process result: {:?}", result);
result result
} }