Skip to content

Commit

Permalink
Replace uses of ! with Void
Browse files Browse the repository at this point in the history
With this commit, the library compiles on stable Rust now.

Close #11
  • Loading branch information
hannobraun committed Mar 14, 2019
1 parent e4dd0a2 commit 642af46
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

use embedded_hal::blocking::i2c;
use void::Void;

use crate::{
init_state,
Expand Down Expand Up @@ -147,7 +148,7 @@ impl I2C<init_state::Disabled> {
}

impl i2c::Write for I2C<init_state::Enabled> {
type Error = !;
type Error = Void;

/// Write to the I2C bus
///
Expand Down Expand Up @@ -190,7 +191,7 @@ impl i2c::Write for I2C<init_state::Enabled> {
}

impl i2c::Read for I2C<init_state::Enabled> {
type Error = !;
type Error = Void;

/// Read from the I2C bus
///
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@
//! [available from NXP]: https://www.nxp.com/docs/en/user-guide/UM10800.pdf

#![feature(never_type)]

#![deny(warnings)]
#![deny(missing_docs)]

Expand Down
5 changes: 3 additions & 2 deletions src/usart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ use embedded_hal::serial::{
Write,
};
use nb;
use void::Void;

use crate::{
dma,
Expand Down Expand Up @@ -341,7 +342,7 @@ impl<'usart, UsartX> Transmitter<'usart, UsartX> where UsartX: Peripheral {
impl<'usart, UsartX> Write<u8> for Transmitter<'usart, UsartX>
where UsartX: Peripheral,
{
type Error = !;
type Error = Void;

fn write(&mut self, word: u8) -> nb::Result<(), Self::Error> {
if self.0.usart.stat.read().txrdy().bit_is_clear() {
Expand Down Expand Up @@ -388,7 +389,7 @@ impl<'usart, UsartX> fmt::Write for Transmitter<'usart, UsartX>
impl<'usart, UsartX> dma::Dest for Transmitter<'usart, UsartX>
where UsartX: Peripheral,
{
type Error = !;
type Error = Void;

fn wait(&mut self) -> nb::Result<(), Self::Error> {
self.flush()
Expand Down

0 comments on commit 642af46

Please sign in to comment.