Skip to content

Commit 939851b

Browse files
committed
Fix some warnings
1 parent d006221 commit 939851b

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

espflash/src/flasher/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use serde::{Deserialize, Serialize};
1717
#[cfg(feature = "serialport")]
1818
use serialport::UsbPortInfo;
1919
use strum::{Display, EnumIter, IntoEnumIterator, VariantNames};
20+
#[cfg(feature = "serialport")]
2021
use xmas_elf::ElfFile;
2122

2223
#[cfg(feature = "serialport")]
@@ -31,7 +32,7 @@ use crate::{
3132
Connection,
3233
Port,
3334
},
34-
error::{ConnectionError, ResultExt},
35+
error::{ConnectionError, ElfError, ResultExt as _},
3536
flasher::stubs::{
3637
FlashStub,
3738
CHIP_DETECT_MAGIC_REG_ADDR,
@@ -41,8 +42,8 @@ use crate::{
4142
image_format::{ram_segments, rom_segments, Segment},
4243
};
4344
use crate::{
44-
error::{ElfError, Error},
4545
targets::{Chip, XtalFrequency},
46+
Error,
4647
};
4748

4849
#[cfg(feature = "serialport")]

espflash/src/targets/esp32s2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use xmas_elf::ElfFile;
55
#[cfg(feature = "serialport")]
66
use super::flash_target::MAX_RAM_BLOCK_SIZE;
77
#[cfg(feature = "serialport")]
8-
use crate::connection::Connection;
8+
use crate::{connection::Connection, flasher::FLASH_WRITE_SIZE};
99
use crate::{
10-
flasher::{FlashData, FlashFrequency, FLASH_WRITE_SIZE},
10+
flasher::{FlashData, FlashFrequency},
1111
image_format::IdfBootloaderFormat,
1212
targets::{Chip, Esp32Params, ReadEFuse, SpiRegisters, Target, XtalFrequency},
1313
Error,

espflash/src/targets/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,27 +144,27 @@ impl Chip {
144144
}
145145

146146
#[cfg(feature = "serialport")]
147-
pub(crate) fn into_rtc_wdt_reset(&self) -> Result<Box<dyn RtcWdtReset>, Error> {
147+
pub(crate) fn into_rtc_wdt_reset(self) -> Result<Box<dyn RtcWdtReset>, Error> {
148148
match self {
149149
Chip::Esp32c3 => Ok(Box::new(Esp32c3)),
150150
Chip::Esp32p4 => Ok(Box::new(Esp32p4)),
151151
Chip::Esp32s2 => Ok(Box::new(Esp32s2)),
152152
Chip::Esp32s3 => Ok(Box::new(Esp32s3)),
153153
_ => Err(Error::UnsupportedFeature {
154-
chip: *self,
154+
chip: self,
155155
feature: "RTC WDT reset".into(),
156156
}),
157157
}
158158
}
159159

160160
#[cfg(feature = "serialport")]
161-
pub(crate) fn into_usb_otg(&self) -> Result<Box<dyn UsbOtg>, Error> {
161+
pub(crate) fn into_usb_otg(self) -> Result<Box<dyn UsbOtg>, Error> {
162162
match self {
163163
Chip::Esp32p4 => Ok(Box::new(Esp32p4)),
164164
Chip::Esp32s2 => Ok(Box::new(Esp32s2)),
165165
Chip::Esp32s3 => Ok(Box::new(Esp32s3)),
166166
_ => Err(Error::UnsupportedFeature {
167-
chip: *self,
167+
chip: self,
168168
feature: "USB OTG".into(),
169169
}),
170170
}

0 commit comments

Comments
 (0)