Skip to content

Commit

Permalink
Fix typos, introduce spellcheck in CI
Browse files Browse the repository at this point in the history
Merges: #123
  • Loading branch information
chrysn authored Sep 16, 2024
2 parents 917d545 + 88f2a22 commit f7abee4
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 35 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,15 @@ jobs:
- name: Run cargo-fmt
run: cargo fmt --check

typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@master

all-done:
needs: [rustfmt, wrappers-tests, examples-and-tests]
needs: [rustfmt, wrappers-tests, examples-and-tests, typos]
# It'd suffice to just do "needs", but GitHub actions insist to have steps
runs-on: ubuntu-latest
steps:
- run: echo "All done"

2 changes: 1 addition & 1 deletion src/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl ADCLine {

/// A configured representation of the single operating-system level ADC that RIOT exposes via its
/// ADC API. The individual ADC lines are addressed as ADCLine structs and can be used uniformly
/// with the (any) ADC struct. The differenes between the hardware ADCs are as hidden to the
/// with the (any) ADC struct. The differences between the hardware ADCs are as hidden to the
/// embedded_hal API as they are hidden to RIOT applications.
pub struct ADC {
pub resolution: riot_sys::adc_res_t,
Expand Down
2 changes: 1 addition & 1 deletion src/auto_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl AutoInitModule {
}
}

// unsafe: The items do not publicly expose anything, so just referncing them from anywhere does no
// unsafe: The items do not publicly expose anything, so just referencing them from anywhere does no
// harm. (Actual usage happens through XFA from C).
unsafe impl Sync for AutoInitModule {}

Expand Down
2 changes: 1 addition & 1 deletion src/dac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub enum DACError {
}

impl DACLine {
/// Creates and intializes a new [`DACLine`].
/// Creates and initializes a new [`DACLine`].
///
/// The `index` indicates which dac device from the current board should be used.
/// For information on how many such devices are available for this board please
Expand Down
4 changes: 2 additions & 2 deletions src/gnrc/ipv6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl<'a, const MAX: usize> core::iter::IntoIterator for &'a AddrList<MAX> {
/// Method implementations mixedly use what RIOT offers and what Rust's standard library offers,
/// depending on what is easiest to use, trusting that the compiler will elide the memory copying
/// that is required for conversion in case the copy is not necessary for alignment purposes.
#[repr(transparent)] // which allows the AddrList addresss to be passed to gnrc_netif_ipv6_addrs_get
#[repr(transparent)] // which allows the AddrList address to be passed to gnrc_netif_ipv6_addrs_get
#[derive(Copy, Clone)]
pub struct Address {
inner: ipv6_addr_t,
Expand Down Expand Up @@ -192,7 +192,7 @@ impl<M: Mode> Pktsnip<M> {
None
} else {
// unsafe: Header is a transparent wrapper around the actual ipv6_hdr_t, and the
// ipv6_hdr_t itself is valid as per Pktsnip reqirements
// ipv6_hdr_t itself is valid as per Pktsnip requirements
Some(unsafe { &*(ptr as *const Header) })
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gnrc_pktbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl<M: Mode> Pktsnip<M> {
}
}

// This is like a wrapper around gnrc_pktsnip_search_type, but gien how simple that function
// This is like a wrapper around gnrc_pktsnip_search_type, but given how simple that function
// is, wrapping it to correct lifetimes would be more verbose than just re-implementing it.
pub fn search_type(&self, type_: gnrc_nettype_t) -> Option<PktsnipPart> {
self.iter_snips().filter(|x| x.type_ == type_).next()
Expand Down
2 changes: 1 addition & 1 deletion src/gnrc_util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Experimental area for GNRC utility functions
//!
//! These are implemented direclty in Rust and do not wrap any RIOT libraries, but seem useful at
//! These are implemented directly in Rust and do not wrap any RIOT libraries, but seem useful at
//! least for the purpose of the author's experiments. It may turn out that they'd make nice
//! additions to the RIOT API, or are completely misguided.

Expand Down
8 changes: 4 additions & 4 deletions src/msg/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub struct ReceivePort<TYPE: Send, const TYPENO: u16> {
// because it contains a statement about the current thread.
//
// (The alternative would be to brand the ReceivePort to the thread, but that only works well
// once there is a per-thread brand, eg. created along the mechansim described in the
// once there is a per-thread brand, eg. created along the mechanism described in the
// NoConfiguredMessages::new TBD).
_not_send: PhantomData<*const ()>,
}
Expand All @@ -62,7 +62,7 @@ pub struct ReceivePort<TYPE: Send, const TYPENO: u16> {

/// Object through which messages of a precise type can be sent to a precise thread.
///
/// Unlike the ReceivePort, the SendPort is Send and Sync by addign the runtime information of the
/// Unlike the ReceivePort, the SendPort is Send and Sync by adding the runtime information of the
/// destination Kernel PID to it. That process / thread is guaranteed to be live (might have
/// crashed to a non-unwinding panic but not been reused) by the construction of SendPort: A
/// SendPort can only be created when the indicated thread gives the appropriate guarantees.
Expand Down Expand Up @@ -188,7 +188,7 @@ pub trait MessageSemantics: Sized {
/// message.
///
/// The conditions for these panics should be evaluatable at build time (i.e. not be part of
/// optimized code); over time these will hopfully become static assertion errors.
/// optimized code); over time these will hopefully become static assertion errors.
// No override should be necessary for this, not even for internal impls (see sealing above)
fn split_off<NewType: Send, const NEW_TYPENO: u16>(
self,
Expand Down Expand Up @@ -312,7 +312,7 @@ impl MessageSemantics for NoConfiguredMessages {
false
}

/// Panicing because if a thread receives unknown messages, it may for the same reason receive
/// Panicking because if a thread receives unknown messages, it may for the same reason receive
/// mistyped messages, and that'd be a safety violation that's better shown in the most visible
/// way.
///
Expand Down
10 changes: 5 additions & 5 deletions src/mutex.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Data-carrying mutex built using RIOT's [mutex] module
//!
//! This roughly mimicks [std::sync::Mutex].
//! This roughly mimics [std::sync::Mutex].
//!
//! [mutex]: https://doc.riot-os.org/group__core__sync__mutex.html
//! [std::sync::mutex]: https://doc.rust-lang.org/std/sync/struct.Mutex.html
Expand All @@ -15,8 +15,8 @@ use core::cell::UnsafeCell;
/// A mutual exclusion primitive useful for protecting shared data
///
/// Unlike the [std::sync::Mutex], this has no concept of poisoning, so waiting for mutexes in
/// paniced (and thus locked) threads will lock the accessing thread as well. This is because RIOT
/// threds don't unwind Rust code. As a consequence, the mutex interface is different from the
/// panicked (and thus locked) threads will lock the accessing thread as well. This is because RIOT
/// threads don't unwind Rust code. As a consequence, the mutex interface is different from the
/// standard library's.
///
/// Several methods (into_inner, get_mut) are not implemented until they're actually needed.
Expand Down Expand Up @@ -71,12 +71,12 @@ impl<T> Mutex<T> {
/// reference for the complete lifetime of the mutex is produced, without the usual mechanisms
/// that'd free the mutex later.
///
/// This is an easy way to get a &'static mut refence in RIOT. Its downsides (compared to
/// This is an easy way to get a &'static mut reference in RIOT. Its downsides (compared to
/// cortex-m-rt's entry mechanisms) are:
///
/// * It has runtime storage cost (one mutex_t)
/// * It has runtime processing cost (primarily the accompanying unwrap which the compiler
/// can't know to optimze out)
/// can't know to optimize out)
/// * It needs a good default value (can be mitigated with MaybeUninit)
///
/// but then again, it's easy.
Expand Down
2 changes: 1 addition & 1 deletion src/saul/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl core::fmt::Display for Phydat {
///
/// Both for the class in general and for its details, Option is used to represent undefined /
/// unknown values, which are used as a wildcard in queries and as an indicator of unknown /
/// unspported types in introspection.
/// unsupported types in introspection.
#[derive(Copy, Clone, Debug)]
pub enum Class {
Actuator(Option<ActuatorClass>),
Expand Down
6 changes: 3 additions & 3 deletions src/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! show up in shells created through Rust without explicit inclusion.
//!
//! * Use [new] to start building a [CommandList]. This can have full closures as commands, but
//! these are available only when the shell is then started throught the CommandList's run
//! these are available only when the shell is then started through the CommandList's run
//! methods.
//!
//! ## Note on complexity of this module
Expand Down Expand Up @@ -373,7 +373,7 @@ impl<const BUFSIZE: usize> CommandList<BUFSIZE> for CommandListEnd {
/// Start a blank list of commands
///
/// This returns an empty command list that can be run as is (to expose RIOT's built-in shell
/// commnads), or as a starting point for adding more commands using its [`CommandList::and`]
/// commands), or as a starting point for adding more commands using its [`CommandList::and`]
/// builder.
pub fn new() -> impl CommandList {
CommandListEnd
Expand All @@ -388,7 +388,7 @@ pub fn new() -> impl CommandList {
/// closure from something that's only a plain function call in C are unavailable.
///
/// The modname identifier needs to be provided as a name that can be used for a private module
/// created by the macro. Tne name literal is the command name as matched by the shell, with the
/// created by the macro. The name literal is the command name as matched by the shell, with the
/// descr literal shown next to it when running `help`. The fun is a local function of static
/// lifetime that gets executed whenever the shell command is invoked.
///
Expand Down
6 changes: 3 additions & 3 deletions src/socket_embedded_nal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use embedded_nal::SocketAddr;
/// Using this is not trivial, as RIOT needs its sockets pinned to memory for their lifetime.
/// Without a heap allocator, this is achieved by allocating all the required UDP sockets in a
/// stack object. To ensure that it is not moved, sockets on it can only be created in (and live
/// only for the duration of) a the `run` callback, which gives the actual implemtation of
/// only for the duration of) a the `run` callback, which gives the actual implementation of
/// UdpClientStack.
///
/// The number of UDP sockets allocated is configurable using the UDPCOUNT const generic.
Expand Down Expand Up @@ -57,7 +57,7 @@ impl<const UDPCOUNT: usize> Stack<UDPCOUNT> {
}

pub struct UdpSocket<'a> {
// This indirection -- not having the sock_udp_t inside UdpSocket -- is necessary becasue the
// This indirection -- not having the sock_udp_t inside UdpSocket -- is necessary because the
// way they are created (embedded-nal .socket()) produces owned values and needs owned values
// later -- while what we'd prefer would be producing owned values and needing pinned ones.
//
Expand Down Expand Up @@ -85,7 +85,7 @@ impl<'a> UdpSocket<'a> {
self.socket.as_mut().map(|s| &mut **s as _)
}

/// If there is an actuall socket in here, close it
/// If there is an actual socket in here, close it
fn close(&mut self) {
if let Some(socket) = self.socket.take() {
unsafe { riot_sys::sock_udp_close(&mut *socket) };
Expand Down
2 changes: 1 addition & 1 deletion src/socket_embedded_nal_tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use embedded_nal::{SocketAddr, TcpClientStack, TcpFullStack};
/// more makes it fail at setup time.
///
/// To use it as an implementation of TcpFullStack, it needs to be pinned, eg. by
/// `pin_utils::pin_mut!(stack)`, and later passed as mutable refernce to the pinned item.
/// `pin_utils::pin_mut!(stack)`, and later passed as mutable reference to the pinned item.
///
/// Note that while it would be perfectly feasible to count the number of open connection and allow
/// this to be dropped when all connections are closed, this will only be implemented once there is
Expand Down
4 changes: 2 additions & 2 deletions src/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use crate::error::NegativeErrorExt;

/// Handle for RIOT's stdio
///
/// This unit struct can be instanciated anywhere, is serviced without any guaranteed
/// This unit struct can be instantiated anywhere, is serviced without any guaranteed
/// synchronization.
///
/// The [dbg] and [println] macros are offered for convenience, and often provide an easier way to
/// write to this.
// Is it OK that everyone can instanciate this at any time just so? Probably yes, because the
// Is it OK that everyone can instantiate this at any time just so? Probably yes, because the
// uart_stdio documentation says nothing about limitations on when to call this.
pub struct Stdio {}

Expand Down
2 changes: 1 addition & 1 deletion src/thread/riot_c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl KernelPID {
fn thread(&self) -> Result<*const riot_sys::thread_t, NoSuchThread> {
// unsafe: C function's "checked" precondition met by type constraint on PID validity
let t = unsafe { riot_sys::thread_get_unchecked(self.0) };
// .as_ref() would have the null check built in, but we can't build a shared refernce out
// .as_ref() would have the null check built in, but we can't build a shared reference out
// of this, only ever access its fields with volatility.
if t == 0 as *mut _ {
Err(NoSuchThread)
Expand Down
2 changes: 1 addition & 1 deletion src/thread/riot_c/creation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl TrackedThread {
self.pid
}

/// Like status of a KernelPID, but infallible: this returnes Stopped if the PID has been
/// Like status of a KernelPID, but infallible: this returns Stopped if the PID has been
/// re-used after our thread has stopped.
// FIXME: This can probably be simplified a lot by just looking into the TCB if it were
// obtained reliably
Expand Down
4 changes: 2 additions & 2 deletions src/vfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//!
//! ## Panics
//!
//! This module violently asserts that file names are UTF-8 encoded (a condition easily satisified
//! This module violently asserts that file names are UTF-8 encoded (a condition easily satisfied
//! if only ASCII file names are used).
//!
//! ## Incomplete
Expand Down Expand Up @@ -155,7 +155,7 @@ impl Drop for File {
/// ## Invariants
///
/// This module maintains that the MaybeUninit is always initialized outside of its own functions,
/// and that no panicing functions are called while it is uninit.
/// and that no panicking functions are called while it is uninit.
#[derive(Default)]
#[pin_project(PinnedDrop)]
pub struct DirSlot(
Expand Down
6 changes: 3 additions & 3 deletions src/ztimer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl<const HZ: u32> Clock<HZ> {
let mut timer = riot_sys::ztimer_t::default();

// FIXME: If we were worried about what this does during unwind, we might put a Drop on a
// type around this. (But currenlty, Rust on RIOT does not unwind).
// type around this. (But currently, Rust on RIOT does not unwind).
//
// As this is later put into timer.arg, this will need to stay put now (but we can't
// directly Pin<&mut> it because we need ownership for the FnOnce)
Expand Down Expand Up @@ -272,7 +272,7 @@ impl<const HZ: u32> Clock<HZ> {
/// overflows; if overflow detection is added to `ztimer_stopwatch` later, the implementation
/// can change.
pub fn time_with_result<R>(&self, closure: impl FnOnce() -> R) -> (Option<Ticks<HZ>>, R) {
// There is a more effient implementation of this than set_during that looks at the result
// There is a more efficient implementation of this than set_during that looks at the result
// of ztimer_remove, but I'm lazy today.
//
// FIXME: Implement it more efficiently.
Expand Down Expand Up @@ -410,7 +410,7 @@ impl Clock<1000000> {
#[cfg(all(feature = "embedded-hal-async", riot_module_ztimer_usec))]
/// Struct that provides the [embedded_hal_async::delay::DelayNs] trait
///
/// Unlike the [Clock] structs that can be instanciated for any ZTimer clock, this is clock
/// Unlike the [Clock] structs that can be instantiated for any ZTimer clock, this is clock
/// independent, because the embedded HAL trait offers delay methods that are provided through
/// different global clocks.
///
Expand Down

0 comments on commit f7abee4

Please sign in to comment.