Skip to content

Commit

Permalink
Fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebraham committed Mar 11, 2025
1 parent d006221 commit 939851b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions espflash/src/flasher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use serde::{Deserialize, Serialize};
#[cfg(feature = "serialport")]
use serialport::UsbPortInfo;
use strum::{Display, EnumIter, IntoEnumIterator, VariantNames};
#[cfg(feature = "serialport")]
use xmas_elf::ElfFile;

#[cfg(feature = "serialport")]
Expand All @@ -31,7 +32,7 @@ use crate::{
Connection,
Port,
},
error::{ConnectionError, ResultExt},
error::{ConnectionError, ElfError, ResultExt as _},
flasher::stubs::{
FlashStub,
CHIP_DETECT_MAGIC_REG_ADDR,
Expand All @@ -41,8 +42,8 @@ use crate::{
image_format::{ram_segments, rom_segments, Segment},
};
use crate::{
error::{ElfError, Error},
targets::{Chip, XtalFrequency},
Error,
};

#[cfg(feature = "serialport")]
Expand Down
4 changes: 2 additions & 2 deletions espflash/src/targets/esp32s2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use xmas_elf::ElfFile;
#[cfg(feature = "serialport")]
use super::flash_target::MAX_RAM_BLOCK_SIZE;
#[cfg(feature = "serialport")]
use crate::connection::Connection;
use crate::{connection::Connection, flasher::FLASH_WRITE_SIZE};
use crate::{
flasher::{FlashData, FlashFrequency, FLASH_WRITE_SIZE},
flasher::{FlashData, FlashFrequency},
image_format::IdfBootloaderFormat,
targets::{Chip, Esp32Params, ReadEFuse, SpiRegisters, Target, XtalFrequency},
Error,
Expand Down
8 changes: 4 additions & 4 deletions espflash/src/targets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,27 +144,27 @@ impl Chip {
}

#[cfg(feature = "serialport")]
pub(crate) fn into_rtc_wdt_reset(&self) -> Result<Box<dyn RtcWdtReset>, Error> {
pub(crate) fn into_rtc_wdt_reset(self) -> Result<Box<dyn RtcWdtReset>, Error> {
match self {
Chip::Esp32c3 => Ok(Box::new(Esp32c3)),
Chip::Esp32p4 => Ok(Box::new(Esp32p4)),
Chip::Esp32s2 => Ok(Box::new(Esp32s2)),
Chip::Esp32s3 => Ok(Box::new(Esp32s3)),
_ => Err(Error::UnsupportedFeature {
chip: *self,
chip: self,
feature: "RTC WDT reset".into(),
}),
}
}

#[cfg(feature = "serialport")]
pub(crate) fn into_usb_otg(&self) -> Result<Box<dyn UsbOtg>, Error> {
pub(crate) fn into_usb_otg(self) -> Result<Box<dyn UsbOtg>, Error> {
match self {
Chip::Esp32p4 => Ok(Box::new(Esp32p4)),
Chip::Esp32s2 => Ok(Box::new(Esp32s2)),
Chip::Esp32s3 => Ok(Box::new(Esp32s3)),
_ => Err(Error::UnsupportedFeature {
chip: *self,
chip: self,
feature: "USB OTG".into(),
}),
}
Expand Down

0 comments on commit 939851b

Please sign in to comment.