Skip to content

Commit

Permalink
Indent some comments as clippy has gotten picky.
Browse files Browse the repository at this point in the history
Apparently nightly Clippy has developed opinions about list item
wrapping in markdown comments that don't match vim's behavior.
  • Loading branch information
cbiffle committed May 26, 2024
1 parent 0128b15 commit d49a601
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 46 deletions.
2 changes: 1 addition & 1 deletion clippy-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ DIRS="os extra/* testsuite/stm32f4 testsuite/stm32g0 testsuite/stm32f3 examples/
for d in $DIRS; do
echo "---- clipping in $d"
pushd $d > /dev/null
cargo clippy -- --deny warnings
cargo ${TOOLCHAIN:=} clippy -- --deny warnings
popd > /dev/null
done
14 changes: 7 additions & 7 deletions extra/list/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ use pin_project::{pin_project, pinned_drop};
/// The list only supports the following operations:
///
/// - [`join`][List::join], which produces a `Future` that will register a new
/// node on the list and resolve when it has been triggered by `wake_*`.
/// node on the list and resolve when it has been triggered by `wake_*`.
///
/// - [`wake_head_if`][List::wake_head_if], which looks at the head node of the
/// list and triggers its owning `Future` if it passes a predicate,
/// list and triggers its owning `Future` if it passes a predicate,
///
/// - And a handful of other wake-related operations that can be expressed in
/// terms of `wake_head_if`: [`wake_while`][List::wake_while],
/// [`wake_all`][List::wake_all], [`wake_one`][List::wake_one].
/// terms of `wake_head_if`: [`wake_while`][List::wake_while],
/// [`wake_all`][List::wake_all], [`wake_one`][List::wake_one].
///
/// In particular, there is no way for the owner of the list to get direct
/// access to any of the nodes in the list -- only act upon them by waking them.
Expand Down Expand Up @@ -112,17 +112,17 @@ use pin_project::{pin_project, pinned_drop};
/// that data structure:
///
/// - Inserting in a sorted list takes time linear in the size of the list
/// (`O(n)`).
/// (`O(n)`).
///
/// - Inserting in an unsorted list takes constant time (`O(1)`).
///
/// - Waking the head node takes constant time (`O(1)`).
///
/// - Waking a series of nodes takes time linear in the length of that sequence
/// (`O(m)`).
/// (`O(m)`).
///
/// - Detaching an arbitrary node (by dropping its owning `Future`) takes
/// constant time (`O(1)`).
/// constant time (`O(1)`).
#[derive(Default)]
pub struct List<T> {
/// Links to the head and tail of the list, if the list is non-empty, or
Expand Down
17 changes: 9 additions & 8 deletions extra/rwlock/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
//! There's a small family of related types in this here crate:
//!
//! - [`RwLock<T>`] contains some data of type `T` and allows either multiple
//! shared references, or one exclusive reference, but not both simultaneously.
//! shared references, or one exclusive reference, but not both
//! simultaneously.
//! - [`SharedGuard<T>`] represents a shared reference to the data guarded by a
//! `RwLock` and allows access to it (via `Deref`).
//! `RwLock` and allows access to it (via `Deref`).
//! - [`ActionPermit<T>`] represents an _exclusive_ reference to the data
//! guarded by a `RwLock`, but once you start doing something that can modify
//! the data, you can't `await`, to ensure that cancellation won't corrupt the
//! guarded data.
//! guarded by a `RwLock`, but once you start doing something that can modify
//! the data, you can't `await`, to ensure that cancellation won't corrupt the
//! guarded data.
//! - [`ExclusiveGuard<T>`] allows arbitrary exclusive access, even across
//! `await` points, but you have to promise the library that the data is
//! inherently cancel-safe (by using the [`lilos::util::CancelSafe`] marker
//! type).
//! `await` points, but you have to promise the library that the data is
//! inherently cancel-safe (by using the [`lilos::util::CancelSafe`] marker
//! type).
//!
//! See the docs on [`RwLock`] for more details.
//!
Expand Down
14 changes: 7 additions & 7 deletions os/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
//! special circumstances:
//!
//! - If you need faster interrupt response, consider allowing some interrupts
//! to preempt task code using [`run_tasks_with_preemption`].
//! to preempt task code using [`run_tasks_with_preemption`].
//! - If you need code to run when no other tasks are ready -- which can be
//! useful for putting the CPU into a low power state, or toggling a pin to
//! signal CPU load on a logic analyzer -- see [`run_tasks_with_idle`]
//! useful for putting the CPU into a low power state, or toggling a pin to
//! signal CPU load on a logic analyzer -- see [`run_tasks_with_idle`]
//! - Finally, if you want to turn on all the bells and whistles, you can use
//! [`run_tasks_with_preemption_and_idle`] which combines the previous two.
//! [`run_tasks_with_preemption_and_idle`] which combines the previous two.
//!
//!
//! # Interrupts, wait, and notify
Expand Down Expand Up @@ -718,11 +718,11 @@ impl Notify {
/// The meaning of `cond` "passing" is defined by the [`TestResult`] trait.
///
/// - In the easiest case, `cond` should return a `bool`. `until` will
/// resolve when `cond` returns `true`.
/// resolve when `cond` returns `true`.
///
/// - For more interesting use cases, `cond` can also return an `Option<T>`.
/// In this case, `until` will resolve when `cond` returns `Some(value)`,
/// producing `value`.
/// In this case, `until` will resolve when `cond` returns `Some(value)`,
/// producing `value`.
///
/// # Cancellation
///
Expand Down
16 changes: 8 additions & 8 deletions os/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@
//! enabling/disabling portions of the system:
//!
//! - `systick` (on by default). Enables reliance on the ARM M-profile SysTick
//! timer for portable timekeeping. Disabling makes the executor smaller at the
//! cost of losing all `time` API. On platforms where the SysTick timer stops
//! during sleep, such as Nordic nRF52, you may want to disable this feature and
//! use a different timekeeping mechanism.
//! timer for portable timekeeping. Disabling makes the executor smaller at
//! the cost of losing all `time` API. On platforms where the SysTick timer
//! stops during sleep, such as Nordic nRF52, you may want to disable this
//! feature and use a different timekeeping mechanism.
//!
//! - `mutex` (on by default). Enables access to the [`mutex`] module for
//! blocking access to shared data. Leaving this feature enabled has no cost if
//! you're not actually using `mutex`.
//! blocking access to shared data. Leaving this feature enabled has no cost
//! if you're not actually using `mutex`.
//!
//! - `spsc` (on by default). Enables access to the [`spsc`] module for
//! single-producer single-consumer inter-task queues. Leaving this feature
//! enabled has no cost if you're not actually using `spsc`.
//! single-producer single-consumer inter-task queues. Leaving this feature
//! enabled has no cost if you're not actually using `spsc`.
//!
//!
//! # Composition and dynamic behavior
Expand Down
28 changes: 14 additions & 14 deletions os/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@
//! - Create a `List<YourTimestamp>`.
//!
//! - To track a waiter in the list, create a `Node<YourTimestamp>` and pass it
//! to [`List::insert_and_wait`]. The node will be inserted in timestamp order,
//! after any existing nodes with the same timestamp. Note that you must `await`
//! (or poll) the future produced by `insert_and_wait` for the node to actually
//! join the list in its proper place.
//! to [`List::insert_and_wait`]. The node will be inserted in timestamp
//! order, after any existing nodes with the same timestamp. Note that you
//! must `await` (or poll) the future produced by `insert_and_wait` for the
//! node to actually join the list in its proper place.
//!
//! - At some future point, wake all nodes in a timestamp range by using either
//! [`List::wake_while`] or, as a convenience for writing timers,
//! [`List::wake_thru`].
//! [`List::wake_while`] or, as a convenience for writing timers,
//! [`List::wake_thru`].
//!
//!
//! # Using as a wait queue
//!
//! - Create a `List<()>`.
//!
//! - To track a waiter in the list, create a `Node<()>` and pass it to
//! [`List::insert_and_wait`]. The node will be inserted at the tail of the
//! list. Note that you must `await` (or poll) the future produced by
//! `insert_and_wait` for the node to actually join the list in its proper
//! place.
//! [`List::insert_and_wait`]. The node will be inserted at the tail of the
//! list. Note that you must `await` (or poll) the future produced by
//! `insert_and_wait` for the node to actually join the list in its proper
//! place.
//!
//! - To wake one waiter, use [`List::wake_one`].
//!
Expand Down Expand Up @@ -192,12 +192,12 @@ use crate::util::{NotSendMarker, Captures};
/// We satisfy a narrow form of `UnsafeCell`'s safety contract:
///
/// - This type is not `Sync` and can't be accessed from multiple threads. This
/// means at most once of its operations (below) is executing at a time.
/// means at most once of its operations (below) is executing at a time.
///
/// - The operations will produce temporary references (both `&` and `&mut`)
/// into the `UnsafeCell`, but will only produce one such reference at a time,
/// and won't let it escape the function. This prevents aliasing in both
/// directions, and deallocation of data while a reference exists.
/// into the `UnsafeCell`, but will only produce one such reference at a time,
/// and won't let it escape the function. This prevents aliasing in both
/// directions, and deallocation of data while a reference exists.
///
/// This puts us into the corner of `UnsafeCell`'s contract that, at the time of
/// this writing, reads "explicitly declared legal for single-threaded code."
Expand Down
2 changes: 1 addition & 1 deletion os/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ pub fn with_deadline<F>(deadline: TickTime, code: F) -> impl Future<Output = Opt
/// Alters a future to impose a timeout on its completion.
///
/// This is equivalent to [`with_deadline`] using a deadline of `TickTime::now()
/// + timeout`. That is, the current time is captured when `with_timeout` is
/// \+ timeout`. That is, the current time is captured when `with_timeout` is
/// called (_not_ at first poll), the provided timeout is added, and that's used
/// as the deadline for the returned future.
///
Expand Down

0 comments on commit d49a601

Please sign in to comment.