Skip to content

Commit f6b8d4b

Browse files
syutaojeda
authored andcommitted
rust: num: fix typos in Bounded documentation
Fix several typos and grammatical errors in the Bounded type documentation: - "less significant bits" -> "least significant bits" - "with in" -> "within" - "withheld" -> "upheld" - "// This" -> "// This" (double space) - "doesn't fits" -> "doesn't fit" (2 occurrences) Reported-by: Miguel Ojeda <ojeda@kernel.org> Closes: #1210 Signed-off-by: Nakamura Shuta <nakamura.shuta@gmail.com> Acked-by: Alexandre Courbot <acourbot@nvidia.com> Acked-by: Yury Norov (NVIDIA) <yury.norov@nvidia.com> Fixes: 01e345e ("rust: num: add Bounded integer wrapping type") Link: https://patch.msgid.link/20251204024336.246587-1-nakamura.shuta@gmail.com [ Removed Link tag due to duplicated URL. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 1e4e2a8 commit f6b8d4b

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

rust/kernel/num/bounded.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ fn fits_within<T: Integer>(value: T, num_bits: u32) -> bool {
4040
fits_within!(value, T, num_bits)
4141
}
4242

43-
/// An integer value that requires only the `N` less significant bits of the wrapped type to be
43+
/// An integer value that requires only the `N` least significant bits of the wrapped type to be
4444
/// encoded.
4545
///
4646
/// This limits the number of usable bits in the wrapped integer type, and thus the stored value to
47-
/// a narrower range, which provides guarantees that can be useful when working with in e.g.
47+
/// a narrower range, which provides guarantees that can be useful when working within e.g.
4848
/// bitfields.
4949
///
5050
/// # Invariants
@@ -56,7 +56,7 @@ fn fits_within<T: Integer>(value: T, num_bits: u32) -> bool {
5656
/// # Examples
5757
///
5858
/// The preferred way to create values is through constants and the [`Bounded::new`] family of
59-
/// constructors, as they trigger a build error if the type invariants cannot be withheld.
59+
/// constructors, as they trigger a build error if the type invariants cannot be upheld.
6060
///
6161
/// ```
6262
/// use kernel::num::Bounded;
@@ -82,7 +82,7 @@ fn fits_within<T: Integer>(value: T, num_bits: u32) -> bool {
8282
/// ```
8383
/// use kernel::num::Bounded;
8484
///
85-
/// // This succeeds because `15` can be represented with 4 unsigned bits.
85+
/// // This succeeds because `15` can be represented with 4 unsigned bits.
8686
/// assert!(Bounded::<u8, 4>::try_new(15).is_some());
8787
///
8888
/// // This fails because `16` cannot be represented with 4 unsigned bits.
@@ -221,7 +221,7 @@ fn fits_within<T: Integer>(value: T, num_bits: u32) -> bool {
221221
/// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bounded();
222222
/// assert_eq!(v.as_deref().copied(), Some(128));
223223
///
224-
/// // Fails because `128` doesn't fits into 6 bits.
224+
/// // Fails because `128` doesn't fit into 6 bits.
225225
/// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bounded();
226226
/// assert_eq!(v, None);
227227
/// ```
@@ -501,7 +501,7 @@ where
501501
/// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bounded();
502502
/// assert_eq!(v.as_deref().copied(), Some(128));
503503
///
504-
/// // Fails because `128` doesn't fits into 6 bits.
504+
/// // Fails because `128` doesn't fit into 6 bits.
505505
/// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bounded();
506506
/// assert_eq!(v, None);
507507
/// ```

0 commit comments

Comments
 (0)