Skip to content

Commit

Permalink
Use the "?" operator instead of try!() in all remaining code
Browse files Browse the repository at this point in the history
  • Loading branch information
pheki committed Mar 11, 2020
1 parent f2d7bc6 commit 0ee1da0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ macro_rules! try_unexport {
match $e {
Ok(res) => res,
Err(e) => {
try!($gpio.unexport());
$gpio.unexport()?;
return Err(e);
}
}
Expand Down Expand Up @@ -217,8 +217,8 @@ impl Pin {
/// let gpio = Pin::new(24);
/// let res = gpio.with_exported(|| {
/// println!("At this point, the Pin is exported");
/// try!(gpio.set_direction(Direction::Low));
/// try!(gpio.set_value(1));
/// gpio.set_direction(Direction::Low)?;
/// gpio.set_value(1)?;
/// // ...
/// Ok(())
/// });
Expand Down Expand Up @@ -731,7 +731,7 @@ impl Stream for PinValueStream {
fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
match self.0.poll() {
Ok(Async::Ready(Some(()))) => {
let value = try!(self.get_value());
let value = self.get_value()?;
Ok(Async::Ready(Some(value)))
}
Ok(Async::Ready(None)) => Ok(Async::Ready(None)),
Expand Down

0 comments on commit 0ee1da0

Please sign in to comment.