From 15dc60d9a1699304447a5f1fd57850d8c8e69ff8 Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Sat, 20 Jun 2020 05:59:12 +1200 Subject: [PATCH] Add explicit 'dyn' to trait references Fix deprecation warnings. --- core_generator/build.rs | 2 +- core_generator/gen.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core_generator/build.rs b/core_generator/build.rs index 45980bb..47925d2 100644 --- a/core_generator/build.rs +++ b/core_generator/build.rs @@ -88,7 +88,7 @@ fn generate_cores_mod_rs(mcus: &[Mcu]) -> Result<(), io::Error> { writeln!(w) } -fn write_core_module(mcu: &Mcu, w: &mut Write) -> 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}};")?; diff --git a/core_generator/gen.rs b/core_generator/gen.rs index 4b0d4da..840684b 100644 --- a/core_generator/gen.rs +++ b/core_generator/gen.rs @@ -2,7 +2,7 @@ use avr_mcu::*; use std::io; use std::io::prelude::*; -pub fn write_registers(mcu: &Mcu, w: &mut Write) -> Result<(), io::Error> { +pub fn write_registers(mcu: &Mcu, w: &mut dyn Write) -> Result<(), io::Error> { for register in mcu.registers() { let ty = if register.size == 1 { "u8" } else { "u16" }; @@ -44,7 +44,7 @@ pub fn write_registers(mcu: &Mcu, w: &mut Write) -> Result<(), io::Error> { Ok(()) } -pub fn write_pins(mcu: &Mcu, w: &mut Write) -> Result<(), io::Error> { +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::*;")?; @@ -87,7 +87,7 @@ pub fn write_pins(mcu: &Mcu, w: &mut Write) -> Result<(), io::Error> { Ok(()) } -pub fn write_spi_modules(mcu: &Mcu, w: &mut Write) -> Result<(), io::Error> { +pub fn write_spi_modules(mcu: &Mcu, w: &mut dyn Write) -> Result<(), io::Error> { if let Some(module) = mcu.module("SPI") { let peripheral = mcu.peripheral("SPI").expect("found SPI module but no peripheral"); let port_peripheral = mcu.port_peripheral(); @@ -129,7 +129,7 @@ pub fn write_spi_modules(mcu: &Mcu, w: &mut Write) -> Result<(), io::Error> { Ok(()) } -pub fn write_usarts(mcu: &Mcu, w: &mut Write) -> Result<(), io::Error> { +pub fn write_usarts(mcu: &Mcu, w: &mut dyn Write) -> Result<(), io::Error> { if let Some(module) = mcu.module("USART") { for usart in module.register_groups.iter() { writeln!(w, "/// The {} module.", usart.name)?; @@ -156,7 +156,7 @@ pub fn write_usarts(mcu: &Mcu, w: &mut Write) -> Result<(), io::Error> { Ok(()) } -pub fn write_timers(mcu: &Mcu, w: &mut Write) -> Result<(), io::Error> { +pub fn write_timers(mcu: &Mcu, w: &mut dyn Write) -> Result<(), io::Error> { if let Some(tc) = mcu.module("TC8") { // Timer/Counter, 8-bit. const TYPE_NAME: &'static str = "Timer8";