Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(pedantic): make Clippy happy with riot-rs-arch #529

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/riot-rs-arch/src/dummy/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub struct Executor;

impl Executor {
#[allow(clippy::new_without_default)]
#[must_use]
pub const fn new() -> Self {
// Actually return a value instead of marking it unimplemented like other dummy
// functions, because this function is const and is thus run during compilation
Expand All @@ -14,6 +15,7 @@ impl Executor {
unimplemented!();
}

#[must_use]
pub fn spawner(&self) -> Spawner {
unimplemented!();
}
Expand Down
3 changes: 3 additions & 0 deletions src/riot-rs-arch/src/dummy/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ macro_rules! define_input_like {
}

impl $type<'_> {
#[must_use]
pub fn is_high(&self) -> bool {
unimplemented!();
}

#[must_use]
pub fn is_low(&self) -> bool {
unimplemented!();
}

#[must_use]
pub fn get_level(&self) -> crate::gpio::input::Level {
unimplemented!();
}
Expand Down
5 changes: 5 additions & 0 deletions src/riot-rs-arch/src/dummy/i2c/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ pub enum Frequency {
}

impl Frequency {
#[must_use]
pub const fn first() -> Self {
Self::_100k
}

#[must_use]
pub const fn last() -> Self {
Self::_400k
}

#[must_use]
pub const fn next(self) -> Option<Self> {
match self {
Self::_100k => Some(Self::_400k),
Expand All @@ -46,6 +49,7 @@ impl Frequency {
}
}

#[must_use]
pub const fn prev(self) -> Option<Self> {
match self {
Self::_100k => None,
Expand All @@ -54,6 +58,7 @@ impl Frequency {
}
}

#[must_use]
pub const fn khz(self) -> u32 {
match self {
Self::_100k => 100,
Expand Down
15 changes: 15 additions & 0 deletions src/riot-rs-arch/src/dummy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
// TODO: redirect to the manufacturer-specific crate documentation when we publish it, and
// mark every item in this dummy module `doc(hidden)`

#![allow(
clippy::missing_errors_doc,
reason = "this module's items are hidden in the docs"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They will be in a soon-to-be PR; marking this PR as draft for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now PR #531.

)]
#![expect(clippy::duplicated_attributes, reason = "Clippy bug #13355")]
#![allow(
clippy::module_name_repetitions,
reason = "this dummy module mimics manufacturer-specific crates"
)]
#![allow(
clippy::needless_pass_by_value,
reason = "this dummy module mimics manufacturer-specific crates"
)]

mod executor;
pub mod gpio;

Expand Down Expand Up @@ -46,6 +60,7 @@ impl From<Peripherals> for OptionalPeripherals {
}
}

#[must_use]
pub fn init() -> OptionalPeripherals {
unimplemented!();
}
Expand Down
1 change: 1 addition & 0 deletions src/riot-rs-arch/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! This module dispatches between the riot-rs architecture support crates.

#![no_std]
#![deny(clippy::pedantic)]

cfg_if::cfg_if! {
if #[cfg(context = "nrf")] {
Expand Down
Loading