From 429fbb7443d48bd4a1709c742c364f1e30d1f6c1 Mon Sep 17 00:00:00 2001 From: occheung Date: Mon, 10 Aug 2020 17:22:46 +0800 Subject: [PATCH] cpld: fixed unwanted mut --- src/cpld.rs | 9 +++++---- src/lib.rs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cpld.rs b/src/cpld.rs index 031180d..6fca3f7 100644 --- a/src/cpld.rs +++ b/src/cpld.rs @@ -21,7 +21,8 @@ use cortex_m::asm::nop; use cortex_m_semihosting::hprintln; use nb::block; -use super::{Parts}; +use crate::spi_slave::Parts; + /* * Enum for structuring error @@ -49,7 +50,7 @@ pub struct CPLD { pub trait SelectChip { type Error; - fn select_chip(&mut self, channel: u8) -> Result<(), Self::Error>; + fn select_chip(&mut self, chip: u8) -> Result<(), Self::Error>; } impl SelectChip for CPLDData @@ -79,14 +80,14 @@ where pub trait DoOnGetRefMutData { fn do_on_get_ref_mut_data( - &mut self, + &self, f: impl FnOnce(cell::RefMut>) -> Result>, ) -> Result>; } impl DoOnGetRefMutData for CPLD { fn do_on_get_ref_mut_data( - &mut self, + &self, f: impl FnOnce(cell::RefMut>) -> Result>, ) -> Result> { let dev = self diff --git a/src/lib.rs b/src/lib.rs index 99dacf1..7392c21 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ #![no_std] mod cpld; -pub use cpld::{CPLD, Error}; +pub use cpld::{CPLDData, CPLD, Error}; mod spi_slave; pub use spi_slave::{SPISlave, Parts};