mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-28 20:53:35 +08:00
firmware: remove some unnecessary unwraps.
This commit is contained in:
parent
e5796e26e1
commit
9f5b76253c
@ -1,5 +1,6 @@
|
||||
use alloc::btree_map::BTreeMap;
|
||||
|
||||
use io::Error as IoError;
|
||||
use moninj_proto::*;
|
||||
use sched::{Io, TcpListener, TcpStream, Error as SchedError};
|
||||
use board_misoc::{clock, csr};
|
||||
@ -184,7 +185,7 @@ fn connection_worker(io: &Io, mut stream: &mut TcpStream) -> Result<(), Error<Sc
|
||||
if clock::get_ms() > next_check {
|
||||
for (&(channel, probe), previous) in watch_list.iter_mut() {
|
||||
let current = read_probe(channel, probe);
|
||||
if previous.is_none() || (previous.unwrap() != current) {
|
||||
if previous.is_none() || previous.unwrap() != current {
|
||||
let message = DeviceMessage::MonitorStatus {
|
||||
channel: channel,
|
||||
probe: probe,
|
||||
@ -200,7 +201,7 @@ fn connection_worker(io: &Io, mut stream: &mut TcpStream) -> Result<(), Error<Sc
|
||||
next_check = clock::get_ms() + 200;
|
||||
}
|
||||
|
||||
io.relinquish().unwrap();
|
||||
io.relinquish().map_err(|err| Error::Io(IoError::Other(err)))?;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
use core::mem;
|
||||
use alloc::{Vec, String, BTreeMap};
|
||||
|
||||
use io::Write;
|
||||
|
||||
const ALIGNMENT: usize = 64;
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -37,7 +35,7 @@ impl Manager {
|
||||
}
|
||||
|
||||
pub fn record_append(&mut self, data: &[u8]) {
|
||||
self.recording_trace.write_all(data).unwrap();
|
||||
self.recording_trace.extend_from_slice(data)
|
||||
}
|
||||
|
||||
pub fn record_stop(&mut self, duration: u64) {
|
||||
|
Loading…
Reference in New Issue
Block a user