Skip to content

Commit

Permalink
Rollup merge of #110419 - jsoref:spelling-library, r=jyn514
Browse files Browse the repository at this point in the history
Spelling library

Split per #110392

I can squash once people are happy w/ the changes. It's really uncommon for large sets of changes to be perfectly acceptable w/o at least some changes.

I probably won't have time to respond until tomorrow or the next day
  • Loading branch information
matthiaskrgr authored Apr 26, 2023
2 parents ea8bd06 + 9a55e9e commit 9babe98
Show file tree
Hide file tree
Showing 26 changed files with 61 additions and 60 deletions.
2 changes: 1 addition & 1 deletion library/alloc/src/collections/vec_deque/spec_from_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ where
default fn spec_from_iter(iterator: I) -> Self {
// Since converting is O(1) now, just re-use the `Vec` logic for
// anything where we can't do something extra-special for `VecDeque`,
// especially as that could save us some monomorphiziation work
// especially as that could save us some monomorphization work
// if one uses the same iterators (like slice ones) with both.
crate::vec::Vec::from_iter(iterator).into()
}
Expand Down
6 changes: 3 additions & 3 deletions library/alloc/src/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,12 @@ impl str {
// See https://www.unicode.org/versions/Unicode7.0.0/ch03.pdf#G33992
// for the definition of `Final_Sigma`.
debug_assert!('Σ'.len_utf8() == 2);
let is_word_final = case_ignoreable_then_cased(from[..i].chars().rev())
&& !case_ignoreable_then_cased(from[i + 2..].chars());
let is_word_final = case_ignorable_then_cased(from[..i].chars().rev())
&& !case_ignorable_then_cased(from[i + 2..].chars());
to.push_str(if is_word_final { "ς" } else { "σ" });
}

fn case_ignoreable_then_cased<I: Iterator<Item = char>>(iter: I) -> bool {
fn case_ignorable_then_cased<I: Iterator<Item = char>>(iter: I) -> bool {
use core::unicode::{Case_Ignorable, Cased};
match iter.skip_while(|&c| Case_Ignorable(c)).next() {
Some(c) => Cased(c),
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/vec/in_place_collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ where
//
// Note: This access to the source wouldn't be allowed by the TrustedRandomIteratorNoCoerce
// contract (used by SpecInPlaceCollect below). But see the "O(1) collect" section in the
// module documenttation why this is ok anyway.
// module documentation why this is ok anyway.
let dst_guard = InPlaceDstBufDrop { ptr: dst_buf, len, cap };
src.forget_allocation_drop_remaining();
mem::forget(dst_guard);
Expand Down
42 changes: 21 additions & 21 deletions library/alloc/tests/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ fn test_move_rev_iterator() {
}

#[test]
fn test_splitator() {
fn test_split_iterator() {
let xs = &[1, 2, 3, 4, 5];

let splits: &[&[_]] = &[&[1], &[3], &[5]];
Expand All @@ -725,7 +725,7 @@ fn test_splitator() {
}

#[test]
fn test_splitator_inclusive() {
fn test_split_iterator_inclusive() {
let xs = &[1, 2, 3, 4, 5];

let splits: &[&[_]] = &[&[1, 2], &[3, 4], &[5]];
Expand All @@ -745,7 +745,7 @@ fn test_splitator_inclusive() {
}

#[test]
fn test_splitator_inclusive_reverse() {
fn test_split_iterator_inclusive_reverse() {
let xs = &[1, 2, 3, 4, 5];

let splits: &[&[_]] = &[&[5], &[3, 4], &[1, 2]];
Expand All @@ -765,7 +765,7 @@ fn test_splitator_inclusive_reverse() {
}

#[test]
fn test_splitator_mut_inclusive() {
fn test_split_iterator_mut_inclusive() {
let xs = &mut [1, 2, 3, 4, 5];

let splits: &[&[_]] = &[&[1, 2], &[3, 4], &[5]];
Expand All @@ -785,7 +785,7 @@ fn test_splitator_mut_inclusive() {
}

#[test]
fn test_splitator_mut_inclusive_reverse() {
fn test_split_iterator_mut_inclusive_reverse() {
let xs = &mut [1, 2, 3, 4, 5];

let splits: &[&[_]] = &[&[5], &[3, 4], &[1, 2]];
Expand All @@ -805,7 +805,7 @@ fn test_splitator_mut_inclusive_reverse() {
}

#[test]
fn test_splitnator() {
fn test_splitn_iterator() {
let xs = &[1, 2, 3, 4, 5];

let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
Expand All @@ -821,7 +821,7 @@ fn test_splitnator() {
}

#[test]
fn test_splitnator_mut() {
fn test_splitn_iterator_mut() {
let xs = &mut [1, 2, 3, 4, 5];

let splits: &[&mut [_]] = &[&mut [1, 2, 3, 4, 5]];
Expand All @@ -837,7 +837,7 @@ fn test_splitnator_mut() {
}

#[test]
fn test_rsplitator() {
fn test_rsplit_iterator() {
let xs = &[1, 2, 3, 4, 5];

let splits: &[&[_]] = &[&[5], &[3], &[1]];
Expand All @@ -855,7 +855,7 @@ fn test_rsplitator() {
}

#[test]
fn test_rsplitnator() {
fn test_rsplitn_iterator() {
let xs = &[1, 2, 3, 4, 5];

let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
Expand Down Expand Up @@ -932,7 +932,7 @@ fn test_split_iterators_size_hint() {
}

#[test]
fn test_windowsator() {
fn test_windows_iterator() {
let v = &[1, 2, 3, 4];

let wins: &[&[_]] = &[&[1, 2], &[2, 3], &[3, 4]];
Expand All @@ -948,13 +948,13 @@ fn test_windowsator() {

#[test]
#[should_panic]
fn test_windowsator_0() {
fn test_windows_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.windows(0);
}

#[test]
fn test_chunksator() {
fn test_chunks_iterator() {
let v = &[1, 2, 3, 4, 5];

assert_eq!(v.chunks(2).len(), 3);
Expand All @@ -972,13 +972,13 @@ fn test_chunksator() {

#[test]
#[should_panic]
fn test_chunksator_0() {
fn test_chunks_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.chunks(0);
}

#[test]
fn test_chunks_exactator() {
fn test_chunks_exact_iterator() {
let v = &[1, 2, 3, 4, 5];

assert_eq!(v.chunks_exact(2).len(), 2);
Expand All @@ -996,13 +996,13 @@ fn test_chunks_exactator() {

#[test]
#[should_panic]
fn test_chunks_exactator_0() {
fn test_chunks_exact_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.chunks_exact(0);
}

#[test]
fn test_rchunksator() {
fn test_rchunks_iterator() {
let v = &[1, 2, 3, 4, 5];

assert_eq!(v.rchunks(2).len(), 3);
Expand All @@ -1020,13 +1020,13 @@ fn test_rchunksator() {

#[test]
#[should_panic]
fn test_rchunksator_0() {
fn test_rchunks_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.rchunks(0);
}

#[test]
fn test_rchunks_exactator() {
fn test_rchunks_exact_iterator() {
let v = &[1, 2, 3, 4, 5];

assert_eq!(v.rchunks_exact(2).len(), 2);
Expand All @@ -1044,7 +1044,7 @@ fn test_rchunks_exactator() {

#[test]
#[should_panic]
fn test_rchunks_exactator_0() {
fn test_rchunks_exact_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.rchunks_exact(0);
}
Expand Down Expand Up @@ -1219,7 +1219,7 @@ fn test_ends_with() {
}

#[test]
fn test_mut_splitator() {
fn test_mut_split_iterator() {
let mut xs = [0, 1, 0, 2, 3, 0, 0, 4, 5, 0];
assert_eq!(xs.split_mut(|x| *x == 0).count(), 6);
for slice in xs.split_mut(|x| *x == 0) {
Expand All @@ -1235,7 +1235,7 @@ fn test_mut_splitator() {
}

#[test]
fn test_mut_splitator_rev() {
fn test_mut_split_iterator_rev() {
let mut xs = [1, 2, 0, 3, 4, 0, 0, 5, 6, 0];
for slice in xs.split_mut(|x| *x == 0).rev().take(4) {
slice.reverse();
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2470,7 +2470,7 @@ fn test_vec_dedup_panicking() {

// Regression test for issue #82533
#[test]
fn test_extend_from_within_panicing_clone() {
fn test_extend_from_within_panicking_clone() {
struct Panic<'dc> {
drop_count: &'dc AtomicU32,
aaaaa: bool,
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/fmt/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
/// .field("bar", &self.bar) // We add `bar` field.
/// .field("another", &self.another) // We add `another` field.
/// // We even add a field which doesn't exist (because why not?).
/// .field("not_existing_field", &1)
/// .field("nonexistent_field", &1)
/// .finish() // We're good to go!
/// }
/// }
///
/// assert_eq!(
/// format!("{:?}", Bar { bar: 10, another: "Hello World".to_string() }),
/// "Bar { bar: 10, another: \"Hello World\", not_existing_field: 1 }",
/// "Bar { bar: 10, another: \"Hello World\", nonexistent_field: 1 }",
/// );
/// ```
#[stable(feature = "debug_builders", since = "1.2.0")]
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2474,7 +2474,7 @@ extern "rust-intrinsic" {
/// This macro should be called as `assert_unsafe_precondition!([Generics](name: Type) => Expression)`
/// where the names specified will be moved into the macro as captured variables, and defines an item
/// to call `const_eval_select` on. The tokens inside the square brackets are used to denote generics
/// for the function declaractions and can be omitted if there is no generics.
/// for the function declarations and can be omitted if there is no generics.
///
/// # Safety
///
Expand Down Expand Up @@ -2733,7 +2733,7 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
// SAFETY: the safety contract for `copy` must be upheld by the caller.
unsafe {
assert_unsafe_precondition!(
"ptr::copy requires that both pointer arguments are aligned aligned and non-null",
"ptr::copy requires that both pointer arguments are aligned and non-null",
[T](src: *const T, dst: *mut T) =>
is_aligned_and_not_null(src) && is_aligned_and_not_null(dst)
);
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/macros/panic.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ the successful result of some computation, `Ok(T)`, or error types that
represent an anticipated runtime failure mode of that computation, `Err(E)`.
`Result` is used alongside user defined types which represent the various
anticipated runtime failure modes that the associated computation could
encounter. `Result` must be propagated manually, often with the the help of the
encounter. `Result` must be propagated manually, often with the help of the
`?` operator and `Try` trait, and they must be reported manually, often with
the help of the `Error` trait.

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ptr/const_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl<T: ?Sized> *const T {
let dest_addr = addr as isize;
let offset = dest_addr.wrapping_sub(self_addr);

// This is the canonical desugarring of this operation
// This is the canonical desugaring of this operation
self.wrapping_byte_offset(offset)
}

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2126,7 +2126,7 @@ mod new_fn_ptr_impl {
/// assert_eq!(unsafe { raw_f2.read_unaligned() }, 2);
/// ```
///
/// See [`addr_of_mut`] for how to create a pointer to unininitialized data.
/// See [`addr_of_mut`] for how to create a pointer to uninitialized data.
/// Doing that with `addr_of` would not make much sense since one could only
/// read the data, and that would be Undefined Behavior.
#[stable(feature = "raw_ref_macros", since = "1.51.0")]
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ptr/mut_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl<T: ?Sized> *mut T {
let dest_addr = addr as isize;
let offset = dest_addr.wrapping_sub(self_addr);

// This is the canonical desugarring of this operation
// This is the canonical desugaring of this operation
self.wrapping_byte_offset(offset)
}

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4451,7 +4451,7 @@ impl<T, const N: usize> SlicePattern for [T; N] {
/// This will do `binomial(N + 1, 2) = N * (N + 1) / 2 = 0, 1, 3, 6, 10, ..`
/// comparison operations.
fn get_many_check_valid<const N: usize>(indices: &[usize; N], len: usize) -> bool {
// NB: The optimzer should inline the loops into a sequence
// NB: The optimizer should inline the loops into a sequence
// of instructions without additional branching.
let mut valid = true;
for (i, &idx) in indices.iter().enumerate() {
Expand Down
6 changes: 3 additions & 3 deletions library/core/tests/asserting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ struct NoCopyNoDebug;
struct NoDebug;

test!(
capture_with_non_copyable_and_non_debugabble_elem_has_correct_params,
capture_with_non_copyable_and_non_debuggable_elem_has_correct_params,
NoCopyNoDebug,
None,
"N/A"
);

test!(capture_with_non_copyable_elem_has_correct_params, NoCopy, None, "N/A");

test!(capture_with_non_debugabble_elem_has_correct_params, NoDebug, None, "N/A");
test!(capture_with_non_debuggable_elem_has_correct_params, NoDebug, None, "N/A");

test!(capture_with_copyable_and_debugabble_elem_has_correct_params, 1i32, Some(1i32), "1");
test!(capture_with_copyable_and_debuggable_elem_has_correct_params, 1i32, Some(1i32), "1");
2 changes: 1 addition & 1 deletion library/core/tests/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn once_cell() {
c.get_or_init(|| 92);
assert_eq!(c.get(), Some(&92));

c.get_or_init(|| panic!("Kabom!"));
c.get_or_init(|| panic!("Kaboom!"));
assert_eq!(c.get(), Some(&92));
}

Expand Down
2 changes: 1 addition & 1 deletion library/core/tests/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fn test_can_not_overflow() {
for base in 2..=36 {
let num = (<$t>::MAX as u128) + 1;

// Calcutate the string length for the smallest overflowing number:
// Calculate the string length for the smallest overflowing number:
let max_len_string = format_radix(num, base as u128);
// Ensure that string length is deemed to potentially overflow:
assert!(can_overflow::<$t>(base, &max_len_string));
Expand Down
13 changes: 7 additions & 6 deletions library/std/src/io/buffered/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,9 @@ fn partial_line_buffered_after_line_write() {
assert_eq!(&writer.get_ref().buffer, b"Line 1\nLine 2\nLine 3");
}

/// Test that, given a partial line that exceeds the length of
/// LineBuffer's buffer (that is, without a trailing newline), that that
/// line is written to the inner writer
/// Test that for calls to LineBuffer::write where the passed bytes do not contain
/// a newline and on their own are greater in length than the internal buffer, the
/// passed bytes are immediately written to the inner writer.
#[test]
fn long_line_flushed() {
let writer = ProgrammableSink::default();
Expand All @@ -844,9 +844,10 @@ fn long_line_flushed() {
}

/// Test that, given a very long partial line *after* successfully
/// flushing a complete line, that that line is buffered unconditionally,
/// and no additional writes take place. This assures the property that
/// `write` should make at-most-one attempt to write new data.
/// flushing a complete line, the very long partial line is buffered
/// unconditionally, and no additional writes take place. This assures
/// the property that `write` should make at-most-one attempt to write
/// new data.
#[test]
fn line_long_tail_not_flushed() {
let writer = ProgrammableSink::default();
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/io/readbuf/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn initialize_unfilled() {
}

#[test]
fn addvance_filled() {
fn advance_filled() {
let buf: &mut [_] = &mut [0; 16];
let mut rbuf: BorrowedBuf<'_> = buf.into();

Expand Down
4 changes: 2 additions & 2 deletions library/std/src/keyword_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@ mod type_keyword {}
/// `unsafe_op_in_unsafe_fn` lint can be enabled to warn against that and require explicit unsafe
/// blocks even inside `unsafe fn`.
///
/// See the [Rustnomicon] and the [Reference] for more information.
/// See the [Rustonomicon] and the [Reference] for more information.
///
/// # Examples
///
Expand Down Expand Up @@ -2129,7 +2129,7 @@ mod type_keyword {}
/// [`impl`]: keyword.impl.html
/// [raw pointers]: ../reference/types/pointer.html
/// [memory safety]: ../book/ch19-01-unsafe-rust.html
/// [Rustnomicon]: ../nomicon/index.html
/// [Rustonomicon]: ../nomicon/index.html
/// [nomicon-soundness]: ../nomicon/safe-unsafe-meaning.html
/// [soundness]: https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#soundness-of-code--of-a-library
/// [Reference]: ../reference/unsafety.html
Expand Down
Loading

0 comments on commit 9babe98

Please sign in to comment.