Skip to content

Commit

Permalink
chore: make clippy happy (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
ROMemories authored Sep 19, 2024
2 parents 76f5a90 + 26ee7b2 commit 7293754
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/riot-rs-embassy-common/src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ impl From<Level> for bool {

impl From<bool> for Level {
fn from(boolean: bool) -> Self {
match boolean {
false => Level::Low,
true => Level::High,
if boolean {
Level::High
} else {
Level::Low
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/riot-rs-embassy-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#![no_std]
#![feature(doc_auto_cfg)]
#![deny(clippy::pedantic)]
#![deny(missing_docs)]

pub mod gpio;
Expand Down
10 changes: 8 additions & 2 deletions src/riot-rs-embassy/src/arch/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ pub mod output {

/// Actual type is architecture-specific.
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum DriveStrength {}
pub enum DriveStrength {
#[doc(hidden)]
Hidden,
}

impl FromDriveStrength for DriveStrength {
fn from(_drive_strength: crate::gpio::DriveStrength<DriveStrength>) -> Self {
Expand All @@ -144,7 +147,10 @@ pub mod output {

/// Actual type is architecture-specific.
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum Speed {}
pub enum Speed {
#[doc(hidden)]
Hidden,
}

impl FromSpeed for Speed {
fn from(_speed: crate::gpio::Speed<Speed>) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion src/riot-rs-embassy/src/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use crate::sendcell::SendCell;
/// TODO: this is a PoC implementation.
/// - takes 24b for each delegate (on arm), which seems too much.
/// - doesn't protect at all against calling [`lend()`](Delegate::lend) or
/// [`with()`](Delegate::with) multiple times
/// [`with()`](Delegate::with) multiple times
/// each, breaking safety assumptions. So while the API seems OK, the implementation
/// needs work.
#[derive(Default)]
Expand Down
4 changes: 4 additions & 0 deletions src/riot-rs-embassy/src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ pub mod input {
/// Fails to compile if the architecture does not support configuring Schmitt trigger on
/// inputs.
pub fn schmitt_trigger(self, enable: bool) -> Self {
#[expect(
clippy::assertions_on_constants,
reason = "the constant depends on the architecture"
)]
const {
assert!(
arch::gpio::input::SCHMITT_TRIGGER_CONFIGURABLE,
Expand Down
4 changes: 2 additions & 2 deletions src/riot-rs-macros/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
/// The peripheral struct must be defined with the `riot_rs::define_peripherals!` macro.
/// - hooks: (*optional*) available hooks are:
/// - `usb_builder_hook`: when present, the macro will define a static `USB_BUILDER_HOOK`
/// of type `UsbBuilderHook`, allowing to access and modify the system-provided
/// `embassy_usb::Builder` through `Delegate::with()`, *before* it is built by the system.
/// of type `UsbBuilderHook`, allowing to access and modify the system-provided
/// `embassy_usb::Builder` through `Delegate::with()`, *before* it is built by the system.
/// - `pool_size`: (*optional*) set the maximum number of concurrent tasks that can be spawned for
/// the function (defaults to `1`).
/// Cannot be used on `autostart` tasks.
Expand Down
2 changes: 1 addition & 1 deletion src/riot-rs-macros/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const RIOT_RS_CRATE_NAME: &str = "riot-rs";
/// # Panics
///
/// - Panics when the `riot-rs` crate cannot be found as a dependency of the crate in which
/// this function is called.
/// this function is called.
/// - Panics if `riot-rs` is used as a dependency of itself.
pub fn riot_rs_crate() -> syn::Ident {
find_crate(RIOT_RS_CRATE_NAME)
Expand Down
1 change: 1 addition & 0 deletions src/riot-rs-runqueue/src/runqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ impl<const N_QUEUES: usize, const N_THREADS: usize> RunQueue<{ N_QUEUES }, { N_T
mod clist {
//! This module implements an array of `N_QUEUES` circular linked lists over an
//! array of size `N_THREADS`.
//!
//! The array is used for "next" pointers, so each integer value in the array
//! corresponds to one element, which can only be in one of the lists.
#[derive(Debug, Copy, Clone)]
Expand Down

0 comments on commit 7293754

Please sign in to comment.