Skip to content

Commit 06df71f

Browse files
authored
Fix typos (#2551)
1 parent 7757077 commit 06df71f

File tree

13 files changed

+31
-31
lines changed

13 files changed

+31
-31
lines changed

rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
edition = "2021"
1010

11-
# The "Default" setting has a heuristic which splits lines too aggresively.
11+
# The "Default" setting has a heuristic which splits lines too aggressively.
1212
# We are willing to revisit this setting in future versions of rustfmt.
1313
# Bugs:
1414
# * https://github.com/rust-lang/rustfmt/issues/3119

src/byte_slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub unsafe trait SplitByteSlice: ByteSlice {
112112
if mid <= self.deref().len() {
113113
// SAFETY: Above, we ensure that `mid <= self.deref().len()`. By
114114
// invariant on `ByteSlice`, a supertrait of `SplitByteSlice`,
115-
// `.deref()` is guranteed to be "stable"; i.e., it will always
115+
// `.deref()` is guaranteed to be "stable"; i.e., it will always
116116
// dereference to a byte slice of the same address and length. Thus,
117117
// we can be sure that the above precondition remains satisfied
118118
// through the call to `split_at_unchecked`.

src/layout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl DstLayout {
299299
SizeInfo::Sized { size: field_size } => {
300300
// If the trailing field is sized, the resulting layout
301301
// will be sized. Its size will be the sum of the
302-
// preceeding layout, the size of the new field, and the
302+
// preceding layout, the size of the new field, and the
303303
// size of inter-field padding between the two.
304304
//
305305
// This will not panic (and is proven with Kani to not
@@ -1050,7 +1050,7 @@ mod tests {
10501050
};
10511051

10521052
// If a cast is invalid, it is either because...
1053-
// 1. there are insufficent bytes at the given region for type:
1053+
// 1. there are insufficient bytes at the given region for type:
10541054
let insufficient_bytes = bytes_len < min_size;
10551055
// 2. performing the cast would misalign type:
10561056
let base = match cast_type {

src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5214,12 +5214,12 @@ pub unsafe trait IntoBytes {
52145214
/// ```
52155215
/// # use zerocopy::IntoBytes;
52165216
/// # let header = u128::MAX;
5217-
/// let mut insufficent_bytes = &mut [0, 0][..];
5217+
/// let mut insufficient_bytes = &mut [0, 0][..];
52185218
///
5219-
/// let write_result = header.write_to_suffix(insufficent_bytes);
5219+
/// let write_result = header.write_to_suffix(insufficient_bytes);
52205220
///
52215221
/// assert!(write_result.is_err());
5222-
/// assert_eq!(insufficent_bytes, [0, 0]);
5222+
/// assert_eq!(insufficient_bytes, [0, 0]);
52235223
/// ```
52245224
#[must_use = "callers should check the return value to see if the operation succeeded"]
52255225
#[inline]
@@ -5276,12 +5276,12 @@ pub unsafe trait IntoBytes {
52765276
///
52775277
/// assert_eq!(bytes, [0, 0, 0, 1, 2, 3, 4, 5, 6, 7]);
52785278
///
5279-
/// let mut insufficent_bytes = &mut [0, 0][..];
5279+
/// let mut insufficient_bytes = &mut [0, 0][..];
52805280
///
5281-
/// let write_result = header.write_to_suffix(insufficent_bytes);
5281+
/// let write_result = header.write_to_suffix(insufficient_bytes);
52825282
///
52835283
/// assert!(write_result.is_err());
5284-
/// assert_eq!(insufficent_bytes, [0, 0]);
5284+
/// assert_eq!(insufficient_bytes, [0, 0]);
52855285
/// ```
52865286
///
52875287
/// If insufficient target bytes are provided, `write_to_suffix` returns
@@ -5290,12 +5290,12 @@ pub unsafe trait IntoBytes {
52905290
/// ```
52915291
/// # use zerocopy::IntoBytes;
52925292
/// # let header = u128::MAX;
5293-
/// let mut insufficent_bytes = &mut [0, 0][..];
5293+
/// let mut insufficient_bytes = &mut [0, 0][..];
52945294
///
5295-
/// let write_result = header.write_to_suffix(insufficent_bytes);
5295+
/// let write_result = header.write_to_suffix(insufficient_bytes);
52965296
///
52975297
/// assert!(write_result.is_err());
5298-
/// assert_eq!(insufficent_bytes, [0, 0]);
5298+
/// assert_eq!(insufficient_bytes, [0, 0]);
52995299
/// ```
53005300
#[must_use = "callers should check the return value to see if the operation succeeded"]
53015301
#[inline]
@@ -5355,7 +5355,7 @@ pub unsafe trait IntoBytes {
53555355
/// ```
53565356
///
53575357
/// If the write fails, `write_to_io` returns `Err` and a partial write may
5358-
/// have occured; e.g.:
5358+
/// have occurred; e.g.:
53595359
///
53605360
/// ```
53615361
/// # use zerocopy::IntoBytes;
@@ -5559,7 +5559,7 @@ pub unsafe trait Unaligned {
55595559
/// The standard library's [`derive(Hash)`][derive@Hash] produces hashes by
55605560
/// individually hashing each field and combining the results. Instead, the
55615561
/// implementations of [`Hash::hash()`] and [`Hash::hash_slice()`] generated by
5562-
/// `derive(ByteHash)` convert the entirey of `self` to a byte slice and hashes
5562+
/// `derive(ByteHash)` convert the entirety of `self` to a byte slice and hashes
55635563
/// it in a single call to [`Hasher::write()`]. This may have performance
55645564
/// advantages.
55655565
///
@@ -5597,7 +5597,7 @@ pub use zerocopy_derive::ByteHash;
55975597
///
55985598
/// The standard library's [`derive(Eq, PartialEq)`][derive@PartialEq] computes
55995599
/// equality by individually comparing each field. Instead, the implementation
5600-
/// of [`PartialEq::eq`] emitted by `derive(ByteHash)` converts the entirey of
5600+
/// of [`PartialEq::eq`] emitted by `derive(ByteHash)` converts the entirety of
56015601
/// `self` and `other` to byte slices and compares those slices for equality.
56025602
/// This may have performance advantages.
56035603
#[cfg(any(feature = "derive", test))]

src/pointer/invariant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ unsafe impl Validity for Uninit {}
145145
/// Formally: uninitialized bytes may only be present in `Ptr<T>`'s referent
146146
/// where they are guaranteed to be present in `T`. This is a dynamic property:
147147
/// if, at a particular byte offset, a valid enum discriminant is set, the
148-
/// subsequent bytes may only have uninitialized bytes as specificed by the
148+
/// subsequent bytes may only have uninitialized bytes as specified by the
149149
/// corresponding enum.
150150
///
151151
/// Formally, given `len = size_of_val_raw(ptr)`, at every byte offset, `b`, in
@@ -201,7 +201,7 @@ unsafe impl<ST: ?Sized, DT: ?Sized> CastableFrom<ST, Initialized, Initialized> f
201201
/// [`Ptr`](crate::Ptr) referents that permit unsynchronized read operations.
202202
///
203203
/// `T: Read<A, R>` implies that a pointer to `T` with aliasing `A` permits
204-
/// unsynchronized read oeprations. This can be because `A` is [`Exclusive`] or
204+
/// unsynchronized read operations. This can be because `A` is [`Exclusive`] or
205205
/// because `T` does not permit interior mutation.
206206
///
207207
/// # Safety

src/ref.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ where
588588
} else {
589589
return Err(SizeError::new(source).into());
590590
};
591-
// SAFETY: The preceeding `source.len().checked_sub(expected_len)`
591+
// SAFETY: The preceding `source.len().checked_sub(expected_len)`
592592
// guarantees that `split_at` is in-bounds.
593593
let (bytes, suffix) = unsafe { source.split_at_unchecked(split_at) };
594594
Self::from_bytes(suffix).map(move |l| (bytes, l))
@@ -883,7 +883,7 @@ mod tests {
883883
#[test]
884884
fn test_mut_slice_into_ref() {
885885
// Prior to #1260/#1299, calling `into_ref` on a `&mut [u8]`-backed
886-
// `Ref` was not supportd.
886+
// `Ref` was not supported.
887887
let mut buf = [0u8];
888888
let r = Ref::<&mut [u8], u8>::from_bytes(&mut buf).unwrap();
889889
assert_eq!(Ref::into_ref(r), &0);

src/split_at.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ where
765765
if l_len.padding_needed_for() == 0 {
766766
// SAFETY: By `T: SplitAt`, `T` is either `[T]`, or a `repr(C)` or
767767
// `repr(transparent)` slice DST, for which the trailing padding
768-
// needed to accomodate `l_len` trailing elements is
768+
// needed to accommodate `l_len` trailing elements is
769769
// `l_len.padding_needed_for()`. If no trailing padding is required,
770770
// the left and right parts are strictly non-overlapping.
771771
Ok(unsafe { self.via_unchecked() })

src/util/macro_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ macro_rules! align_of {
264264
// correctly-align the entire struct.
265265
//
266266
// This macro computes the alignment of `$ty` by counting the number of
267-
// bytes preceeding `_trailing`. For instance, if the alignment of `$ty`
267+
// bytes preceding `_trailing`. For instance, if the alignment of `$ty`
268268
// is `1`, then no padding is required align `_trailing` and it will be
269269
// located immediately after `_byte` at offset 1. If the alignment of
270270
// `$ty` is 2, then a single padding byte is required before

src/util/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ macro_rules! impl_for_transmute_from {
249249
};
250250
}
251251

252-
/// Implements a trait for a type, bounding on each memeber of the power set of
252+
/// Implements a trait for a type, bounding on each member of the power set of
253253
/// a set of type variables. This is useful for implementing traits for tuples
254254
/// or `fn` types.
255255
///

src/util/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ pub(crate) mod testutil {
739739
/// A `T` which is guaranteed not to satisfy `align_of::<A>()`.
740740
///
741741
/// It must be the case that `align_of::<T>() < align_of::<A>()` in order
742-
/// fot this type to work properly.
742+
/// for this type to work properly.
743743
#[repr(C)]
744744
pub(crate) struct ForceUnalign<T: Unaligned, A> {
745745
// The outer struct is aligned to `A`, and, thanks to `repr(C)`, `t` is

0 commit comments

Comments
 (0)