Skip to content

Commit

Permalink
Consistent spelling of "adapter" in the standard library
Browse files Browse the repository at this point in the history
Change all occurrences of "(A|a)daptor" to "(A|a)dapter".
  • Loading branch information
steffahn committed Jul 30, 2021
1 parent 87dc824 commit 8d2bb93
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions library/core/src/alloc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ pub unsafe trait Allocator {
Ok(new_ptr)
}

/// Creates a "by reference" adaptor for this instance of `Allocator`.
/// Creates a "by reference" adapter for this instance of `Allocator`.
///
/// The returned adaptor also implements `Allocator` and will simply borrow this.
/// The returned adapter also implements `Allocator` and will simply borrow this.
#[inline(always)]
fn by_ref(&self) -> &Self
where
Expand Down
6 changes: 3 additions & 3 deletions library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ pub trait Iterator {
/// more idiomatic to use a `for` loop, but `for_each` may be more legible
/// when processing items at the end of longer iterator chains. In some
/// cases `for_each` may also be faster than a loop, because it will use
/// internal iteration on adaptors like `Chain`.
/// internal iteration on adapters like `Chain`.
///
/// [`for`]: ../../book/ch03-05-control-flow.html#looping-through-a-collection-with-for
///
Expand Down Expand Up @@ -1293,7 +1293,7 @@ pub trait Iterator {
Take::new(self, n)
}

/// An iterator adaptor similar to [`fold`] that holds internal state and
/// An iterator adapter similar to [`fold`] that holds internal state and
/// produces a new iterator.
///
/// [`fold`]: Iterator::fold
Expand Down Expand Up @@ -1604,7 +1604,7 @@ pub trait Iterator {

/// Borrows an iterator, rather than consuming it.
///
/// This is useful to allow applying iterator adaptors while still
/// This is useful to allow applying iterator adapters while still
/// retaining ownership of the original iterator.
///
/// # Examples
Expand Down
2 changes: 1 addition & 1 deletion library/core/tests/iter/adapters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use core::cell::Cell;

/// An iterator that panics whenever `next` or next_back` is called
/// after `None` has already been returned. This does not violate
/// `Iterator`'s contract. Used to test that iterator adaptors don't
/// `Iterator`'s contract. Used to test that iterator adapters don't
/// poll their inner iterators after exhausting them.
pub struct NonFused<I> {
iter: I,
Expand Down
24 changes: 12 additions & 12 deletions library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,9 @@ pub trait Read {
default_read_exact(self, buf)
}

/// Creates a "by reference" adaptor for this instance of `Read`.
/// Creates a "by reference" adapter for this instance of `Read`.
///
/// The returned adaptor also implements `Read` and will simply borrow this
/// The returned adapter also implements `Read` and will simply borrow this
/// current reader.
///
/// # Examples
Expand Down Expand Up @@ -889,7 +889,7 @@ pub trait Read {
Bytes { inner: self }
}

/// Creates an adaptor which will chain this stream with another.
/// Creates an adapter which will chain this stream with another.
///
/// The returned `Read` instance will first read all bytes from this object
/// until EOF is encountered. Afterwards the output is equivalent to the
Expand Down Expand Up @@ -927,7 +927,7 @@ pub trait Read {
Chain { first: self, second: next, done_first: false }
}

/// Creates an adaptor which will read at most `limit` bytes from it.
/// Creates an adapter which will read at most `limit` bytes from it.
///
/// This function returns a new instance of `Read` which will read at most
/// `limit` bytes, after which it will always return EOF ([`Ok(0)`]). Any
Expand Down Expand Up @@ -1326,7 +1326,7 @@ impl Initializer {
/// * The [`write`] method will attempt to write some data into the object,
/// returning how many bytes were successfully written.
///
/// * The [`flush`] method is useful for adaptors and explicit buffers
/// * The [`flush`] method is useful for adapters and explicit buffers
/// themselves for ensuring that all buffered data has been pushed out to the
/// 'true sink'.
///
Expand Down Expand Up @@ -1646,12 +1646,12 @@ pub trait Write {
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> Result<()> {
// Create a shim which translates a Write to a fmt::Write and saves
// off I/O errors. instead of discarding them
struct Adaptor<'a, T: ?Sized + 'a> {
struct Adapter<'a, T: ?Sized + 'a> {
inner: &'a mut T,
error: Result<()>,
}

impl<T: Write + ?Sized> fmt::Write for Adaptor<'_, T> {
impl<T: Write + ?Sized> fmt::Write for Adapter<'_, T> {
fn write_str(&mut self, s: &str) -> fmt::Result {
match self.inner.write_all(s.as_bytes()) {
Ok(()) => Ok(()),
Expand All @@ -1663,7 +1663,7 @@ pub trait Write {
}
}

let mut output = Adaptor { inner: self, error: Ok(()) };
let mut output = Adapter { inner: self, error: Ok(()) };
match fmt::write(&mut output, fmt) {
Ok(()) => Ok(()),
Err(..) => {
Expand All @@ -1677,9 +1677,9 @@ pub trait Write {
}
}

/// Creates a "by reference" adaptor for this instance of `Write`.
/// Creates a "by reference" adapter for this instance of `Write`.
///
/// The returned adaptor also implements `Write` and will simply borrow this
/// The returned adapter also implements `Write` and will simply borrow this
/// current writer.
///
/// # Examples
Expand Down Expand Up @@ -2263,7 +2263,7 @@ pub trait BufRead: Read {
}
}

/// Adaptor to chain together two readers.
/// Adapter to chain together two readers.
///
/// This struct is generally created by calling [`chain`] on a reader.
/// Please see the documentation of [`chain`] for more details.
Expand Down Expand Up @@ -2414,7 +2414,7 @@ impl<T, U> SizeHint for Chain<T, U> {
}
}

/// Reader adaptor which limits the bytes read from an underlying reader.
/// Reader adapter which limits the bytes read from an underlying reader.
///
/// This struct is generally created by calling [`take`] on a reader.
/// Please see the documentation of [`take`] for more details.
Expand Down

0 comments on commit 8d2bb93

Please sign in to comment.