Cleanup to use question mark

This commit is contained in:
Jeremy Soller 2016-09-08 19:31:26 -06:00
commit 9afe0645e1

View file

@ -23,10 +23,8 @@ pub fn exec(path: &[u8], args: &[[usize; 2]]) -> Result<usize> {
}
pub fn getpid() -> Result<usize> {
if let Some(context_lock) = context::contexts().current() {
let context = context_lock.read();
Ok(context.id)
} else {
Err(Error::NoProcess)
}
let contexts = context::contexts();
let context_lock = contexts.current().ok_or(Error::NoProcess)?;
let context = context_lock.read();
Ok(context.id)
}