Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
39zde committed Oct 14, 2024
1 parent 308104b commit 8b74d71
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/byte_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl ByteStr {
///
/// ## Safety
/// `bytes` must contain valid UTF-8. In a release build it is undefined
/// behaviour to call this with `bytes` that is not valid UTF-8.
/// behavior to call this with `bytes` that is not valid UTF-8.
pub unsafe fn from_utf8_unchecked(bytes: Bytes) -> ByteStr {
if cfg!(debug_assertions) {
match str::from_utf8(&bytes) {
Expand Down
2 changes: 1 addition & 1 deletion src/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl Extensions {
self.map.as_ref().map_or(true, |map| map.is_empty())
}

/// Get the numer of extensions available.
/// Get the number of extensions available.
///
/// # Example
///
Expand Down
6 changes: 3 additions & 3 deletions src/header/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1659,13 +1659,13 @@ const SCRATCH_BUF_OVERFLOW: usize = SCRATCH_BUF_SIZE + 1;
fn uninit_u8_array() -> [MaybeUninit<u8>; SCRATCH_BUF_SIZE] {
let arr = MaybeUninit::<[MaybeUninit<u8>; SCRATCH_BUF_SIZE]>::uninit();
// Safety: assume_init() is claiming that an array of MaybeUninit<>
// has been initilized, but MaybeUninit<>'s do not require initilizaton.
// has been initialized, but MaybeUninit<>'s do not require initialization.
unsafe { arr.assume_init() }
}

// Assuming all the elements are initilized, get a slice of them.
// Assuming all the elements are initialized, get a slice of them.
//
// Safety: All elements of `slice` must be initilized to prevent
// Safety: All elements of `slice` must be initialized to prevent
// undefined behavior.
unsafe fn slice_assume_init<T>(slice: &[MaybeUninit<T>]) -> &[T] {
&*(slice as *const [MaybeUninit<T>] as *const [T])
Expand Down
2 changes: 1 addition & 1 deletion src/uri/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Authority {
// Not public while `bytes` is unstable.
pub(super) fn from_shared(s: Bytes) -> Result<Self, InvalidUri> {
// Precondition on create_authority: trivially satisfied by the
// identity clousre
// identity closure
create_authority(s, |s| s)
}

Expand Down
6 changes: 3 additions & 3 deletions src/uri/scheme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ impl Scheme2<usize> {
// Return scheme
return Ok(Scheme2::Other(i));
}
// Invald scheme character, abort
// Invalid scheme character, abort
0 => break,
_ => {}
}
Expand Down Expand Up @@ -349,10 +349,10 @@ mod test {

#[test]
fn invalid_scheme_is_error() {
Scheme::try_from("my_funky_scheme").expect_err("Unexpectly valid Scheme");
Scheme::try_from("my_funky_scheme").expect_err("Unexpectedly valid Scheme");

// Invalid UTF-8
Scheme::try_from([0xC0].as_ref()).expect_err("Unexpectly valid Scheme");
Scheme::try_from([0xC0].as_ref()).expect_err("Unexpectedly valid Scheme");
}

fn scheme(s: &str) -> Scheme {
Expand Down

0 comments on commit 8b74d71

Please sign in to comment.