Skip to content

Commit

Permalink
pass clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
gvaradarajan committed Feb 7, 2025
1 parent aea8df0 commit 4d915ee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion micro-rdk/src/common/sensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub trait Readings {
}
}

pub trait Sensor: Readings + Status + DoCommand {}
pub trait Sensor: Readings + Status + DoCommand + Send {}

pub type SensorType = Arc<Mutex<dyn Sensor>>;

Expand Down
5 changes: 5 additions & 0 deletions micro-rdk/src/esp32/coredump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ impl Coredump {
}
}

// *mut esp_idf_svc::sys::esp_flash_t (which is one of the attributes for `esp_partition_t`) does not
// implement Send. We force an implementation of Send here so we can actually wrap in an Arc<Mutex<_>>
// for now, but we should investigate a better canonical solution
unsafe impl Send for Coredump {}

impl Sensor for Coredump {}

impl Readings for Coredump {
Expand Down
5 changes: 5 additions & 0 deletions micro-rdk/src/esp32/hcsr04.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ pub struct HCSR04Sensor {
isr_shared_state: Arc<IsrSharedState>,
}

// `Notification` contains an instance of `PhantomData<const* ()>`, but `const* ()` does not
// implement Send. We force an implementation of Send here so we can actually wrap in an Arc<Mutex<_>>
// for now, but we should investigate a better canonical solution
unsafe impl Send for HCSR04Sensor {}

impl HCSR04Sensor {
pub fn from_config(cfg: ConfigType, _deps: Vec<Dependency>) -> Result<SensorType, SensorError> {
let trigger_pin = cfg
Expand Down

0 comments on commit 4d915ee

Please sign in to comment.