Skip to content

Commit 0129924

Browse files
authored
Merge branch 'main' into additions
2 parents 0f4d52d + 8ab2335 commit 0129924

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

src/indexmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ where
11441144
/// Remove the key-value pair equivalent to `key` and return its value.
11451145
///
11461146
/// Like `Vec::swap_remove`, the pair is removed by swapping it with the last element of the map
1147-
/// and popping it off. **This perturbs the postion of what used to be the last element!**
1147+
/// and popping it off. **This perturbs the position of what used to be the last element!**
11481148
///
11491149
/// Return `None` if `key` is not in map.
11501150
///

src/mpmc.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
//! not.
6868
//! - All execution times are in clock cycles. 1 clock cycle = 125 ns.
6969
//! - Execution time is *dependent* of `mem::size_of::<T>()`. Both operations include one
70-
//! `memcpy(T)` in their successful path.
70+
//! `memcpy(T)` in their successful path.
7171
//! - The optimization level is indicated in parentheses.
7272
//! - The numbers reported correspond to the successful path (i.e. `Some` is returned by `dequeue`
73-
//! and `Ok` is returned by `enqueue`).
73+
//! and `Ok` is returned by `enqueue`).
7474
//!
7575
//! # Portability
7676
//!
@@ -151,8 +151,6 @@ pub type MpMcQueue<T, const N: usize> = MpMcQueueInner<T, OwnedStorage<N>>;
151151
pub type MpMcQueueView<T> = MpMcQueueInner<T, ViewStorage>;
152152

153153
impl<T, const N: usize> MpMcQueue<T, N> {
154-
const EMPTY_CELL: Cell<T> = Cell::new(0);
155-
156154
const ASSERT: [(); 1] = [()];
157155

158156
/// Creates an empty queue
@@ -167,7 +165,7 @@ impl<T, const N: usize> MpMcQueue<T, N> {
167165

168166
let mut cell_count = 0;
169167

170-
let mut result_cells: [Cell<T>; N] = [Self::EMPTY_CELL; N];
168+
let mut result_cells: [Cell<T>; N] = [const { Cell::new(0) }; N];
171169
while cell_count != N {
172170
result_cells[cell_count] = Cell::new(cell_count);
173171
cell_count += 1;

src/pool.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! This module/API is only available on these compilation targets:
66
//!
77
//! - ARM architectures which instruction set include the LDREX, CLREX and STREX instructions, e.g.
8-
//! `thumbv7m-none-eabi` but not `thumbv6m-none-eabi`
8+
//! `thumbv7m-none-eabi` but not `thumbv6m-none-eabi`
99
//! - 32-bit x86, e.g. `i686-unknown-linux-gnu`
1010
//!
1111
//! # Benchmarks
@@ -37,8 +37,8 @@
3737
//! ```
3838
//!
3939
//! - measurement method: the cycle counter (CYCCNT) register was sampled each time a breakpoint
40-
//! (`bkpt`) was hit. the difference between the "after" and the "before" value of CYCCNT yields the
41-
//! execution time in clock cycles.
40+
//! (`bkpt`) was hit. the difference between the "after" and the "before" value of CYCCNT yields the
41+
//! execution time in clock cycles.
4242
//!
4343
//! | API | clock cycles |
4444
//! |------------------------------|--------------|

src/spsc.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@
9292
//!
9393
//! - All execution times are in clock cycles. 1 clock cycle = 125 ns.
9494
//! - Execution time is *dependent* of `mem::size_of::<T>()`. Both operations include one
95-
//! `memcpy(T)` in their successful path.
95+
//! `memcpy(T)` in their successful path.
9696
//! - The optimization level is indicated in the first row.
9797
//! - The numbers reported correspond to the successful path (i.e. `Some` is returned by `dequeue`
98-
//! and `Ok` is returned by `enqueue`).
98+
//! and `Ok` is returned by `enqueue`).
9999
100100
use core::{borrow::Borrow, cell::UnsafeCell, fmt, hash, mem::MaybeUninit, ptr};
101101

@@ -135,7 +135,6 @@ pub type Queue<T, const N: usize> = QueueInner<T, OwnedStorage<N>>;
135135
pub type QueueView<T> = QueueInner<T, ViewStorage>;
136136

137137
impl<T, const N: usize> Queue<T, N> {
138-
const INIT: UnsafeCell<MaybeUninit<T>> = UnsafeCell::new(MaybeUninit::uninit());
139138
/// Creates an empty queue with a fixed capacity of `N - 1`
140139
pub const fn new() -> Self {
141140
// Const assert N > 1
@@ -144,7 +143,7 @@ impl<T, const N: usize> Queue<T, N> {
144143
Queue {
145144
head: AtomicUsize::new(0),
146145
tail: AtomicUsize::new(0),
147-
buffer: [Self::INIT; N],
146+
buffer: [const { UnsafeCell::new(MaybeUninit::uninit()) }; N],
148147
}
149148
}
150149

src/string/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,9 +852,9 @@ pub fn format<const N: usize>(args: Arguments<'_>) -> Result<String<N>, fmt::Err
852852
/// There are two possible error cases. Both return the unit type [`core::fmt::Error`].
853853
///
854854
/// - In case the formatting exceeds the string's capacity. This error does not exist in
855-
/// the standard library as the string would just grow.
855+
/// the standard library as the string would just grow.
856856
/// - If a formatting trait implementation returns an error. The standard library panics
857-
/// in this case.
857+
/// in this case.
858858
///
859859
/// # Examples
860860
///
@@ -1027,7 +1027,7 @@ mod tests {
10271027
let s: String<4> = String::try_from("ab").unwrap();
10281028
let b: Vec<u8, 4> = s.into_bytes();
10291029
assert_eq!(b.len(), 2);
1030-
assert_eq!(&[b'a', b'b'], &b[..]);
1030+
assert_eq!(b"ab", &b[..]);
10311031
}
10321032

10331033
#[test]
@@ -1102,7 +1102,7 @@ mod tests {
11021102
match s.pop() {
11031103
Some(c) => {
11041104
assert_eq!(s.len(), 1);
1105-
assert_eq!(c, '\u{0301}'); // accute accent of e
1105+
assert_eq!(c, '\u{0301}'); // acute accent of e
11061106
}
11071107
None => panic!(),
11081108
};

0 commit comments

Comments
 (0)