Skip to content

Commit

Permalink
Merge pull request #6 from atlas-aero/5-improve-qa
Browse files Browse the repository at this point in the history
Fixed Clippy warnings + added targets to QA pipeline
  • Loading branch information
marius-meissner authored Dec 18, 2024
2 parents 552ee65 + f96a49d commit 31caa51
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ jobs:
matrix:
target:
- thumbv7m-none-eabi
- thumbv8m.main-none-eabihf
- riscv32imac-unknown-none-elf
rust:
- stable
- beta
Expand Down
6 changes: 3 additions & 3 deletions src/guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'a, B: Write + Read> LockFreeGuard<'a, B> {
}
}

impl<'a, B> RefGuard<B> for LockFreeGuard<'a, B>
impl<B> RefGuard<B> for LockFreeGuard<'_, B>
where
B: Write + Read<u8>,
{
Expand Down Expand Up @@ -63,7 +63,7 @@ impl<'a, B: Write + Read> CsMutexGuard<'a, B> {
}

#[cfg(feature = "cortex-m")]
impl<'a, B> RefGuard<B> for CsMutexGuard<'a, B>
impl<B> RefGuard<B> for CsMutexGuard<'_, B>
where
B: Write + Read<u8>,
{
Expand Down Expand Up @@ -96,7 +96,7 @@ impl<'a, B: Write + Read> SpinGuard<'a, B> {
}

#[cfg(feature = "spin")]
impl<'a, B> RefGuard<B> for SpinGuard<'a, B>
impl<B> RefGuard<B> for SpinGuard<'_, B>
where
B: Write + Read<u8>,
{
Expand Down
14 changes: 7 additions & 7 deletions src/pin_refreshable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ where
}
}

impl<'a, B, R> RefreshableInputPin for Pin<'a, B, R, Input, RefreshMode>
impl<B, R> RefreshableInputPin for Pin<'_, B, R, Input, RefreshMode>
where
B: Write + Read,
R: RefGuard<B>,
Expand All @@ -75,7 +75,7 @@ where
}
}

impl<'a, B, R> RefreshableOutputPin for Pin<'a, B, R, Output, RefreshMode>
impl<B, R> RefreshableOutputPin for Pin<'_, B, R, Output, RefreshMode>
where
B: Write + Read,
R: RefGuard<B>,
Expand All @@ -94,7 +94,7 @@ where
}
}

impl<'a, B, R> Pin<'a, B, R, Output, RefreshMode>
impl<B, R> Pin<'_, B, R, Output, RefreshMode>
where
B: Write + Read,
R: RefGuard<B>,
Expand All @@ -111,7 +111,7 @@ where
}
}

impl<'a, B, R> InputPin for Pin<'a, B, R, Input, RefreshMode>
impl<B, R> InputPin for Pin<'_, B, R, Input, RefreshMode>
where
B: Write + Read,
R: RefGuard<B>,
Expand All @@ -133,7 +133,7 @@ where
}
}

impl<'a, B, R> OutputPin for Pin<'a, B, R, Output, RefreshMode>
impl<B, R> OutputPin for Pin<'_, B, R, Output, RefreshMode>
where
B: Read + Write,
R: RefGuard<B>,
Expand All @@ -157,7 +157,7 @@ where
}
}

impl<'a, B, R> StatefulOutputPin for Pin<'a, B, R, Output, RefreshMode>
impl<B, R> StatefulOutputPin for Pin<'_, B, R, Output, RefreshMode>
where
B: Write + Read,
R: RefGuard<B>,
Expand All @@ -171,7 +171,7 @@ where
}
}

impl<'a, B, R> toggleable::Default for Pin<'a, B, R, Output, RefreshMode>
impl<B, R> toggleable::Default for Pin<'_, B, R, Output, RefreshMode>
where
B: Write + Read,
R: RefGuard<B>,
Expand Down
8 changes: 4 additions & 4 deletions src/pin_regular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ where
}
}

impl<'a, B, R> InputPin for Pin<'a, B, R, Input, RegularAccessMode>
impl<B, R> InputPin for Pin<'_, B, R, Input, RegularAccessMode>
where
B: Write + Read,
R: RefGuard<B>,
Expand All @@ -47,7 +47,7 @@ where
}
}

impl<'a, B, R> OutputPin for Pin<'a, B, R, Output, RegularAccessMode>
impl<B, R> OutputPin for Pin<'_, B, R, Output, RegularAccessMode>
where
B: Read + Write,
R: RefGuard<B>,
Expand All @@ -74,7 +74,7 @@ where
}
}

impl<'a, B, R> StatefulOutputPin for Pin<'a, B, R, Output, RegularAccessMode>
impl<B, R> StatefulOutputPin for Pin<'_, B, R, Output, RegularAccessMode>
where
B: Write + Read,
R: RefGuard<B>,
Expand All @@ -90,7 +90,7 @@ where
}
}

impl<'a, B, R> toggleable::Default for Pin<'a, B, R, Output, RegularAccessMode>
impl<B, R> toggleable::Default for Pin<'_, B, R, Output, RegularAccessMode>
where
B: Write + Read,
R: RefGuard<B>,
Expand Down
14 changes: 7 additions & 7 deletions src/pins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
//!
//! Due to the I2C overhead, this module offers two options for state management:
//! * [Regular access mode](RegularAccessMode): The state is synchronously updated when calling
//! state functions like `is_high()`, causing 1:1 I2C operations for each individual call.
//! state functions like `is_high()`, causing 1:1 I2C operations for each individual call.
//! * [Refresh access mode](RefreshMode): Register states are internally cached. Functions like
//! `is_high()` are just using the cached state. The state is updated explicitly, but for all pins at once.
//! In the best case, the I2C overhead is reduced to one eighth. See [below examples](#refreshable-access-mode) for more details.
//! `is_high()` are just using the cached state. The state is updated explicitly, but for all pins at once.
//! In the best case, the I2C overhead is reduced to one eighth. See [below examples](#refreshable-access-mode) for more details.
//!
//! ## Setup
//! Individual pins can be fetched using [PCA9539](crate::expander::PCA9539) instance.
Expand Down Expand Up @@ -199,7 +199,7 @@ impl<B: Write + Read, R: RefGuard<B>> Pins<B, R> {
/// Currently there are two modes supported:
/// * Regular: State of the pin is synchronously fetched from I2C bus when calling functions like `is_high()`
/// * Refreshable: State of all pins is refreshed explicitly and functions like `is_high()` are working on a cached state.
/// This reducing the I2C overhead
/// This reducing the I2C overhead
pub trait AccessMode {}

/// State of the pin is synchronously fetched from I2C bus
Expand Down Expand Up @@ -238,7 +238,7 @@ where
pub(crate) access_mode: PhantomData<A>,
}

impl<'a, B, R, A> Pin<'a, B, R, Input, A>
impl<B, R, A> Pin<'_, B, R, Input, A>
where
B: Write + Read,
R: RefGuard<B>,
Expand All @@ -256,7 +256,7 @@ where
}
}

impl<'a, B, R, A> Pin<'a, B, R, Output, A>
impl<B, R, A> Pin<'_, B, R, Output, A>
where
B: Write + Read,
R: RefGuard<B>,
Expand All @@ -273,7 +273,7 @@ where
}
}

impl<'a, B, M, R, A> Pin<'a, B, R, M, A>
impl<B, M, R, A> Pin<'_, B, R, M, A>
where
B: Write + Read,
R: RefGuard<B>,
Expand Down

0 comments on commit 31caa51

Please sign in to comment.