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

ci: integrate clippy #103

Merged
merged 3 commits into from
Feb 22, 2024
Merged
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
26 changes: 23 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
merge_group:

jobs:
CI:
build:
runs-on: ubuntu-latest

env:
Expand Down Expand Up @@ -58,14 +58,34 @@ jobs:

laze build --partition hash:${{ matrix.partition }} --builders microbit-v2,nrf52840dk,rpi-pico,rpi-pico-w -g

lint:
runs-on: ubuntu-latest

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy

- name: rust cache
uses: Swatinem/rust-cache@v2

# TODO: we'll eventually want to check the whole workspace with --workspace
# TODO: we'll eventually want to check relevant feature combinations
# TODO: we may want to use --no-deps as well
- run: cargo clippy --verbose --locked -p riot-rs-embassy

CI-success:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Final Results
needs: [CI]
needs: [build]
steps:
- run: |
result="${{ needs.CI.result }}"
result="${{ needs.build.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
Expand Down
17 changes: 14 additions & 3 deletions src/riot-rs-embassy/src/arch/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@
/// Dummy type.
///
/// See the `OptionalPeripherals` type of your Embassy architecture crate instead.
#[derive(Default)]
pub struct OptionalPeripherals;

/// Dummy type.
pub struct Peripherals;

impl From<Peripherals> for OptionalPeripherals {
fn from(_peripherals: Peripherals) -> Self {
Self {}
}
}

mod executor {
use embassy_executor::SpawnToken;

Expand All @@ -25,15 +35,16 @@ mod executor {
pub struct Spawner {}

impl Spawner {
pub fn spawn<S>(&self, token: SpawnToken<S>) -> Result<(), ()> {
#[allow(clippy::result_unit_err)]
pub fn spawn<S>(&self, _token: SpawnToken<S>) -> Result<(), ()> {
Ok(())
}
}
}
pub use executor::{Executor, Spawner};

pub fn init(_: ()) -> OptionalPeripherals {
OptionalPeripherals {}
pub fn init(_: OptionalPeripherals) -> Peripherals {
Peripherals {}
}

pub struct SWI;
2 changes: 1 addition & 1 deletion src/riot-rs-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cfg_if::cfg_if! {
else {
mod arch {
pub fn init() {}
pub fn benchmark<F: Fn() -> ()>(_iterations: usize, f: F) -> core::result::Result<usize, ()> {
pub fn benchmark<F: Fn()>(_iterations: usize, _f: F) -> core::result::Result<usize, ()> {
unimplemented!();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/riot-rs-rt/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use super::debug;

pub trait Testable {
fn run(&self) -> ();
fn run(&self);
}

impl<T> Testable for T
Expand Down
Loading