From 0963ff0f7f2ce5d55090f1df08faa886f09c1446 Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Sat, 20 Jun 2020 06:03:43 +1200 Subject: [PATCH] Switch the crate to Rust edition '2018' --- Cargo.toml | 1 + core_generator/build.rs | 3 +-- core_generator/gen.rs | 2 +- src/modules/spi/clock.rs | 2 +- src/modules/spi/mod.rs | 2 +- src/modules/timer/timer16.rs | 2 +- src/modules/timer/timer8.rs | 2 +- src/modules/usart.rs | 2 +- src/pin.rs | 2 +- src/prelude.rs | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e04c30c..8617d8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "ruduino" version = "0.1.1" +edition = "2018" authors = [ "The AVR-Rust Project Developers", "Jake Goulding ", diff --git a/core_generator/build.rs b/core_generator/build.rs index 47925d2..7e19bcc 100644 --- a/core_generator/build.rs +++ b/core_generator/build.rs @@ -91,8 +91,7 @@ fn generate_cores_mod_rs(mcus: &[Mcu]) -> Result<(), io::Error> { fn write_core_module(mcu: &Mcu, w: &mut dyn Write) -> Result<(), io::Error> { writeln!(w, "//! Core for {}.", mcu.device.name)?; writeln!(w)?; - writeln!(w, "use {{RegisterBits, Register}};")?; - writeln!(w, "use modules;")?; + writeln!(w, "use crate::{{modules, RegisterBits, Register}};")?; writeln!(w)?; gen::write_registers(mcu, w)?; diff --git a/core_generator/gen.rs b/core_generator/gen.rs index 840684b..e2e37a2 100644 --- a/core_generator/gen.rs +++ b/core_generator/gen.rs @@ -48,7 +48,7 @@ pub fn write_pins(mcu: &Mcu, w: &mut dyn Write) -> Result<(), io::Error> { if let Some(port) = mcu.peripheral("PORT") { writeln!(w, "pub mod port {{")?; writeln!(w, " use super::*;")?; - writeln!(w, " use Pin;")?; + writeln!(w, " use crate::Pin;")?; writeln!(w)?; for instance in port.instances.iter() { diff --git a/src/modules/spi/clock.rs b/src/modules/spi/clock.rs index 92fe90c..3d6ba35 100644 --- a/src/modules/spi/clock.rs +++ b/src/modules/spi/clock.rs @@ -1,4 +1,4 @@ -use config; +use crate::config; /// A clock mask. /// diff --git a/src/modules/spi/mod.rs b/src/modules/spi/mod.rs index 73dac79..3104210 100644 --- a/src/modules/spi/mod.rs +++ b/src/modules/spi/mod.rs @@ -4,7 +4,7 @@ mod clock; // FIXME: Start using this module or delete!!! #[allow(dead_code)] mod settings; -use {Register, Pin}; +use crate::{Register, Pin}; /// An SPI module. /// diff --git a/src/modules/timer/timer16.rs b/src/modules/timer/timer16.rs index 961f75b..f7cb27e 100644 --- a/src/modules/timer/timer16.rs +++ b/src/modules/timer/timer16.rs @@ -1,4 +1,4 @@ -use {RegisterBits, Register}; +use crate::{RegisterBits, Register}; use core::marker; /// A 16-bit timer. diff --git a/src/modules/timer/timer8.rs b/src/modules/timer/timer8.rs index a02f6d5..8f77114 100644 --- a/src/modules/timer/timer8.rs +++ b/src/modules/timer/timer8.rs @@ -1,4 +1,4 @@ -use {RegisterBits, Register}; +use crate::{RegisterBits, Register}; use core::marker; /// A 8-bit timer. diff --git a/src/modules/usart.rs b/src/modules/usart.rs index 7e8bc77..5a1078d 100644 --- a/src/modules/usart.rs +++ b/src/modules/usart.rs @@ -1,4 +1,4 @@ -use Register; +use crate::Register; pub trait HardwareUsart { /// The USART data register. diff --git a/src/pin.rs b/src/pin.rs index 806ba99..a63d4b7 100644 --- a/src/pin.rs +++ b/src/pin.rs @@ -1,4 +1,4 @@ -use Register; +use crate::Register; /// Represents whether a pin is an input or an output. pub enum DataDirection { diff --git a/src/prelude.rs b/src/prelude.rs index a5e529e..5d10476 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,4 +1,4 @@ //! Re-exports commonly-used APIs that can be imported at once. -pub use interrupt::without_interrupts; +pub use crate::interrupt::without_interrupts;