Skip to content

Commit

Permalink
apply clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kelko committed Oct 7, 2024
1 parent 1d3782c commit f960ac6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/keret-controller/src/domain/application_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ where
/// run the next cycle of the main logic loop, returning the new state
pub(crate) fn next_cycle(&mut self, mode: &AppMode) -> AppMode {
let next = self
.calculate_next_state(&mode)
.calculate_next_state(mode)
.unwrap_or_else(handle_runtime_error);
self.show_mode(&next);

Expand Down
6 changes: 3 additions & 3 deletions src/keret-controller/src/domain/model/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ impl From<u64> for Duration {
}
}

impl Into<u64> for Duration {
impl From<Duration> for u64 {
#[inline(always)]
fn into(self) -> u64 {
self.0
fn from(val: Duration) -> Self {
val.0
}
}
6 changes: 3 additions & 3 deletions src/keret-controller/src/domain/model/instant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ impl From<u64> for Instant {
}

// extract the u64 timestamp from the instant
impl Into<u64> for &Instant {
impl From<&Instant> for u64 {
#[inline(always)]
fn into(self) -> u64 {
self.0
fn from(val: &Instant) -> Self {
val.0
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/keret-controller/src/domain/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ impl From<Duration> for TrackResult {
}

// extract the duration as u64
impl Into<u64> for TrackResult {
impl From<TrackResult> for u64 {
#[inline]
fn into(self) -> u64 {
self.0.into()
fn from(val: TrackResult) -> Self {
val.0.into()
}
}
9 changes: 3 additions & 6 deletions src/keret-controller/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ mod infrastructure;
/// convenience type alias to make code shorter/more readable
/// meant for those static values which exist once and used from interrupts and inside domain layer
type Singleton<T> = Mutex<RefCell<Option<T>>>;
type AppService<'a> =
ApplicationService<'a, RunningTimer<RTC1>, Display<TIMER1>, InputControls, SerialBus<UARTE0>>;

use crate::{
domain::{model::AppMode, port::Display as _, ApplicationService},
Expand Down Expand Up @@ -80,12 +82,7 @@ fn main() -> ! {
}

/// initialize the board, creating all helper objects and put those necessary in the Mutexes
fn initialize_app_service<'a>(
board: Board,
) -> (
ApplicationService<'a, RunningTimer<RTC1>, Display<TIMER1>, InputControls, SerialBus<UARTE0>>,
Timer<TIMER0, Periodic>,
) {
fn initialize_app_service<'a>(board: Board) -> (AppService<'a>, Timer<TIMER0, Periodic>) {
let mut display = Display::new(board.TIMER1, board.display_pins);
display.show_mode(&AppMode::Idle);

Expand Down

0 comments on commit f960ac6

Please sign in to comment.