Skip to content

Commit c606612

Browse files
bors[bot]no111u3
andauthored
Merge #167
167: Change library edition to 2018 r=thejpster a=no111u3 Crate edition updated to 2018. Any fixes are applied by `cargo fix` utility. It includes same part with #162 because in 2018 this warnings are errors. Code formatting will be introduced in another PR(such as #166) Co-authored-by: Boris Vinogradov <no111u3@gmail.com>
2 parents 8f20839 + 70c3254 commit c606612

File tree

6 files changed

+41
-40
lines changed

6 files changed

+41
-40
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ authors = [
66
categories = ["asynchronous", "embedded", "hardware-support", "no-std"]
77
description = " A Hardware Abstraction Layer (HAL) for embedded systems "
88
documentation = "https://docs.rs/embedded-hal"
9+
edition = "2018"
910
keywords = ["hal", "IO"]
1011
license = "MIT OR Apache-2.0"
1112
name = "embedded-hal"

src/blocking/serial.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ pub mod write {
2929
///
3030
/// [`serial::Write`]: ../../serial/trait.Write.html
3131
/// [`blocking::serial::Write`]: ../trait.Write.html
32-
pub trait Default<Word>: ::serial::Write<Word> {}
32+
pub trait Default<Word>: crate::serial::Write<Word> {}
3333

34-
impl<S, Word> ::blocking::serial::Write<Word> for S
34+
impl<S, Word> crate::blocking::serial::Write<Word> for S
3535
where
3636
S: Default<Word>,
3737
Word: Clone,

src/blocking/spi.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ pub trait WriteIter<W> {
3434
pub mod transfer {
3535
/// Default implementation of `blocking::spi::Transfer<W>` for implementers of
3636
/// `spi::FullDuplex<W>`
37-
pub trait Default<W>: ::spi::FullDuplex<W> {}
37+
pub trait Default<W>: crate::spi::FullDuplex<W> {}
3838

39-
impl<W, S> ::blocking::spi::Transfer<W> for S
39+
impl<W, S> crate::blocking::spi::Transfer<W> for S
4040
where
4141
S: Default<W>,
4242
W: Clone,
@@ -57,9 +57,9 @@ pub mod transfer {
5757
/// Blocking write
5858
pub mod write {
5959
/// Default implementation of `blocking::spi::Write<W>` for implementers of `spi::FullDuplex<W>`
60-
pub trait Default<W>: ::spi::FullDuplex<W> {}
60+
pub trait Default<W>: crate::spi::FullDuplex<W> {}
6161

62-
impl<W, S> ::blocking::spi::Write<W> for S
62+
impl<W, S> crate::blocking::spi::Write<W> for S
6363
where
6464
S: Default<W>,
6565
W: Clone,
@@ -82,9 +82,9 @@ pub mod write {
8282
pub mod write_iter {
8383
/// Default implementation of `blocking::spi::WriteIter<W>` for implementers of
8484
/// `spi::FullDuplex<W>`
85-
pub trait Default<W>: ::spi::FullDuplex<W> {}
85+
pub trait Default<W>: crate::spi::FullDuplex<W> {}
8686

87-
impl<W, S> ::blocking::spi::WriteIter<W> for S
87+
impl<W, S> crate::blocking::spi::WriteIter<W> for S
8888
where
8989
S: Default<W>,
9090
W: Clone,

src/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! TODO write example of usage
44
use core::fmt::{Result, Write};
55

6-
impl<Word, Error> Write for ::serial::Write<Word, Error=Error>
6+
impl<Word, Error> Write for dyn (crate::serial::Write<Word, Error=Error>)
77
where
88
Word: From<u8>,
99
{

src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
//! extern crate nb;
9797
//!
9898
//! # use std as core;
99-
//! use core::convert::Infallible;
99+
//! use ::core::convert::Infallible;
100100
//!
101101
//! /// A count down timer
102102
//! pub trait CountDown {
@@ -385,7 +385,7 @@
385385
//!
386386
//! extern crate embedded_hal as hal;
387387
//!
388-
//! #[macro_use(await)]
388+
//! #[macro_use(r#await)]
389389
//! extern crate nb;
390390
//!
391391
//! use std::ops::Generator;
@@ -415,7 +415,7 @@
415415
//! loop {
416416
//! // `await!` means "suspend / yield here" instead of "block until
417417
//! // completion"
418-
//! await!(timer.wait()).unwrap(); // NOTE(unwrap) E = Infallible
418+
//! nb::r#await!(timer.wait()).unwrap(); // NOTE(unwrap) E = Infallible
419419
//!
420420
//! state = !state;
421421
//!
@@ -429,8 +429,8 @@
429429
//!
430430
//! let mut loopback = (move || {
431431
//! loop {
432-
//! let byte = await!(serial.read()).unwrap();
433-
//! await!(serial.write(byte)).unwrap();
432+
//! let byte = nb::r#await!(serial.read()).unwrap();
433+
//! nb::r#await!(serial.write(byte)).unwrap();
434434
//! }
435435
//! });
436436
//!
@@ -557,7 +557,7 @@
557557
//! #![feature(generator_trait)]
558558
//!
559559
//! extern crate embedded_hal as hal;
560-
//! #[macro_use(await)]
560+
//! #[macro_use(r#await)]
561561
//! extern crate nb;
562562
//!
563563
//! use std::ops::Generator;
@@ -576,8 +576,8 @@
576576
//! move || {
577577
//! let n = buffer.len();
578578
//! for i in 0..n {
579-
//! await!(spi.send(buffer[i]))?;
580-
//! buffer[i] = await!(spi.read())?;
579+
//! nb::r#await!(spi.send(buffer[i]))?;
580+
//! buffer[i] = nb::r#await!(spi.read())?;
581581
//! }
582582
//!
583583
//! Ok((spi, buffer))
@@ -595,7 +595,7 @@
595595
//! extern crate nb;
596596
//!
597597
//! use hal::prelude::*;
598-
//! use core::convert::Infallible;
598+
//! use ::core::convert::Infallible;
599599
//!
600600
//! fn flush<S>(serial: &mut S, cb: &mut CircularBuffer)
601601
//! where

src/prelude.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,43 @@
44
//! performing a glob import.
55
66
#[cfg(feature = "unproven")]
7-
pub use adc::OneShot as _embedded_hal_adc_OneShot;
8-
pub use blocking::delay::DelayMs as _embedded_hal_blocking_delay_DelayMs;
9-
pub use blocking::delay::DelayUs as _embedded_hal_blocking_delay_DelayUs;
10-
pub use blocking::i2c::{
7+
pub use crate::adc::OneShot as _embedded_hal_adc_OneShot;
8+
pub use crate::blocking::delay::DelayMs as _embedded_hal_blocking_delay_DelayMs;
9+
pub use crate::blocking::delay::DelayUs as _embedded_hal_blocking_delay_DelayUs;
10+
pub use crate::blocking::i2c::{
1111
Read as _embedded_hal_blocking_i2c_Read, Write as _embedded_hal_blocking_i2c_Write,
1212
WriteRead as _embedded_hal_blocking_i2c_WriteRead,
1313
};
1414
#[cfg(feature = "unproven")]
15-
pub use blocking::rng::Read as _embedded_hal_blocking_rng_Read;
16-
pub use blocking::serial::Write as _embedded_hal_blocking_serial_Write;
17-
pub use blocking::spi::{
15+
pub use crate::blocking::rng::Read as _embedded_hal_blocking_rng_Read;
16+
pub use crate::blocking::serial::Write as _embedded_hal_blocking_serial_Write;
17+
pub use crate::blocking::spi::{
1818
Transfer as _embedded_hal_blocking_spi_Transfer, Write as _embedded_hal_blocking_spi_Write,
1919
};
2020
#[allow(deprecated)]
2121
#[cfg(feature = "unproven")]
22-
pub use digital::InputPin as _embedded_hal_digital_InputPin;
22+
pub use crate::digital::InputPin as _embedded_hal_digital_InputPin;
2323
#[allow(deprecated)]
24-
pub use digital::OutputPin as _embedded_hal_digital_OutputPin;
24+
pub use crate::digital::OutputPin as _embedded_hal_digital_OutputPin;
2525
#[cfg(feature = "unproven")]
2626
#[allow(deprecated)]
27-
pub use digital::ToggleableOutputPin as _embedded_hal_digital_ToggleableOutputPin;
27+
pub use crate::digital::ToggleableOutputPin as _embedded_hal_digital_ToggleableOutputPin;
2828
#[cfg(feature = "unproven")]
29-
pub use rng::Read as _embedded_hal_rng_Read;
30-
pub use serial::Read as _embedded_hal_serial_Read;
31-
pub use serial::Write as _embedded_hal_serial_Write;
32-
pub use spi::FullDuplex as _embedded_hal_spi_FullDuplex;
33-
pub use timer::CountDown as _embedded_hal_timer_CountDown;
29+
pub use crate::rng::Read as _embedded_hal_rng_Read;
30+
pub use crate::serial::Read as _embedded_hal_serial_Read;
31+
pub use crate::serial::Write as _embedded_hal_serial_Write;
32+
pub use crate::spi::FullDuplex as _embedded_hal_spi_FullDuplex;
33+
pub use crate::timer::CountDown as _embedded_hal_timer_CountDown;
3434
#[cfg(feature = "unproven")]
35-
pub use watchdog::Watchdog as _embedded_hal_watchdog_Watchdog;
35+
pub use crate::watchdog::Watchdog as _embedded_hal_watchdog_Watchdog;
3636
#[cfg(feature = "unproven")]
37-
pub use watchdog::WatchdogDisable as _embedded_hal_watchdog_WatchdogDisable;
37+
pub use crate::watchdog::WatchdogDisable as _embedded_hal_watchdog_WatchdogDisable;
3838
#[cfg(feature = "unproven")]
39-
pub use watchdog::WatchdogEnable as _embedded_hal_watchdog_WatchdogEnable;
39+
pub use crate::watchdog::WatchdogEnable as _embedded_hal_watchdog_WatchdogEnable;
4040
#[cfg(feature = "unproven")]
41-
pub use Capture as _embedded_hal_Capture;
41+
pub use crate::Capture as _embedded_hal_Capture;
4242
#[cfg(feature = "unproven")]
43-
pub use Pwm as _embedded_hal_Pwm;
44-
pub use PwmPin as _embedded_hal_PwmPin;
43+
pub use crate::Pwm as _embedded_hal_Pwm;
44+
pub use crate::PwmPin as _embedded_hal_PwmPin;
4545
#[cfg(feature = "unproven")]
46-
pub use Qei as _embedded_hal_Qei;
46+
pub use crate::Qei as _embedded_hal_Qei;

0 commit comments

Comments
 (0)