Skip to content

Commit 0a522ad

Browse files
committed
Merge pull request #19873 from drewm1980/master
Standardize some usages of "which" in docstrings Reviewed-by: steveklabnik
2 parents 48a47c4 + 8fcc832 commit 0a522ad

File tree

6 files changed

+41
-41
lines changed

6 files changed

+41
-41
lines changed

src/doc/guide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4439,7 +4439,7 @@ for i in range(0u, nums.len()) {
44394439
```
44404440
44414441
This is strictly worse than using an actual iterator. The `.iter()` method on
4442-
vectors returns an iterator which iterates through a reference to each element
4442+
vectors returns an iterator that iterates through a reference to each element
44434443
of the vector in turn. So write this:
44444444
44454445
```{rust}

src/libcollections/ring_buf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ impl<T> RingBuf<T> {
377377
}
378378
}
379379

380-
/// Returns a front-to-back iterator which returns mutable references.
380+
/// Returns a front-to-back iterator that returns mutable references.
381381
///
382382
/// # Examples
383383
///

src/libcore/iter.rs

+26-26
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ pub trait Iterator<A> {
110110
#[unstable = "new convention for extension traits"]
111111
/// An extension trait providing numerous methods applicable to all iterators.
112112
pub trait IteratorExt<A>: Iterator<A> {
113-
/// Chain this iterator with another, returning a new iterator which will
114-
/// finish iterating over the current iterator, and then it will iterate
113+
/// Chain this iterator with another, returning a new iterator that will
114+
/// finish iterating over the current iterator, and then iterate
115115
/// over the other specified iterator.
116116
///
117117
/// # Example
@@ -130,7 +130,7 @@ pub trait IteratorExt<A>: Iterator<A> {
130130
Chain{a: self, b: other, flag: false}
131131
}
132132

133-
/// Creates an iterator which iterates over both this and the specified
133+
/// Creates an iterator that iterates over both this and the specified
134134
/// iterators simultaneously, yielding the two elements as pairs. When
135135
/// either iterator returns None, all further invocations of next() will
136136
/// return None.
@@ -151,7 +151,7 @@ pub trait IteratorExt<A>: Iterator<A> {
151151
Zip{a: self, b: other}
152152
}
153153

154-
/// Creates a new iterator which will apply the specified function to each
154+
/// Creates a new iterator that will apply the specified function to each
155155
/// element returned by the first, yielding the mapped element instead.
156156
///
157157
/// # Example
@@ -169,8 +169,8 @@ pub trait IteratorExt<A>: Iterator<A> {
169169
Map{iter: self, f: f}
170170
}
171171

172-
/// Creates an iterator which applies the predicate to each element returned
173-
/// by this iterator. Only elements which have the predicate evaluate to
172+
/// Creates an iterator that applies the predicate to each element returned
173+
/// by this iterator. Only elements that have the predicate evaluate to
174174
/// `true` will be yielded.
175175
///
176176
/// # Example
@@ -187,7 +187,7 @@ pub trait IteratorExt<A>: Iterator<A> {
187187
Filter{iter: self, predicate: predicate}
188188
}
189189

190-
/// Creates an iterator which both filters and maps elements.
190+
/// Creates an iterator that both filters and maps elements.
191191
/// If the specified function returns None, the element is skipped.
192192
/// Otherwise the option is unwrapped and the new value is yielded.
193193
///
@@ -205,7 +205,7 @@ pub trait IteratorExt<A>: Iterator<A> {
205205
FilterMap { iter: self, f: f }
206206
}
207207

208-
/// Creates an iterator which yields a pair of the value returned by this
208+
/// Creates an iterator that yields a pair of the value returned by this
209209
/// iterator plus the current index of iteration.
210210
///
211211
/// # Example
@@ -248,7 +248,7 @@ pub trait IteratorExt<A>: Iterator<A> {
248248
Peekable{iter: self, peeked: None}
249249
}
250250

251-
/// Creates an iterator which invokes the predicate on elements until it
251+
/// Creates an iterator that invokes the predicate on elements until it
252252
/// returns false. Once the predicate returns false, all further elements are
253253
/// yielded.
254254
///
@@ -268,7 +268,7 @@ pub trait IteratorExt<A>: Iterator<A> {
268268
SkipWhile{iter: self, flag: false, predicate: predicate}
269269
}
270270

271-
/// Creates an iterator which yields elements so long as the predicate
271+
/// Creates an iterator that yields elements so long as the predicate
272272
/// returns true. After the predicate returns false for the first time, no
273273
/// further elements will be yielded.
274274
///
@@ -287,8 +287,8 @@ pub trait IteratorExt<A>: Iterator<A> {
287287
TakeWhile{iter: self, flag: false, predicate: predicate}
288288
}
289289

290-
/// Creates an iterator which skips the first `n` elements of this iterator,
291-
/// and then it yields all further items.
290+
/// Creates an iterator that skips the first `n` elements of this iterator,
291+
/// and then yields all further items.
292292
///
293293
/// # Example
294294
///
@@ -305,8 +305,8 @@ pub trait IteratorExt<A>: Iterator<A> {
305305
Skip{iter: self, n: n}
306306
}
307307

308-
/// Creates an iterator which yields the first `n` elements of this
309-
/// iterator, and then it will always return None.
308+
/// Creates an iterator that yields the first `n` elements of this
309+
/// iterator, and then will always return None.
310310
///
311311
/// # Example
312312
///
@@ -324,7 +324,7 @@ pub trait IteratorExt<A>: Iterator<A> {
324324
Take{iter: self, n: n}
325325
}
326326

327-
/// Creates a new iterator which behaves in a similar fashion to fold.
327+
/// Creates a new iterator that behaves in a similar fashion to fold.
328328
/// There is a state which is passed between each iteration and can be
329329
/// mutated as necessary. The yielded values from the closure are yielded
330330
/// from the Scan instance when not None.
@@ -1223,7 +1223,7 @@ impl<A, T: Clone + RandomAccessIterator<A>> RandomAccessIterator<A> for Cycle<T>
12231223
}
12241224
}
12251225

1226-
/// An iterator which strings two iterators together
1226+
/// An iterator that strings two iterators together
12271227
#[deriving(Clone)]
12281228
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
12291229
#[stable]
@@ -1297,7 +1297,7 @@ for Chain<T, U> {
12971297
}
12981298
}
12991299

1300-
/// An iterator which iterates two other iterators simultaneously
1300+
/// An iterator that iterates two other iterators simultaneously
13011301
#[deriving(Clone)]
13021302
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
13031303
#[stable]
@@ -1380,7 +1380,7 @@ RandomAccessIterator<(A, B)> for Zip<T, U> {
13801380
}
13811381
}
13821382

1383-
/// An iterator which maps the values of `iter` with `f`
1383+
/// An iterator that maps the values of `iter` with `f`
13841384
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
13851385
#[stable]
13861386
pub struct Map<A, B, I: Iterator<A>, F: FnMut(A) -> B> {
@@ -1454,7 +1454,7 @@ impl<A, B, I, F> RandomAccessIterator<B> for Map<A, B, I, F> where
14541454
}
14551455
}
14561456

1457-
/// An iterator which filters the elements of `iter` with `predicate`
1457+
/// An iterator that filters the elements of `iter` with `predicate`
14581458
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
14591459
#[stable]
14601460
pub struct Filter<A, I, P> where I: Iterator<A>, P: FnMut(&A) -> bool {
@@ -1512,7 +1512,7 @@ impl<A, I, P> DoubleEndedIterator<A> for Filter<A, I, P> where
15121512
}
15131513
}
15141514

1515-
/// An iterator which uses `f` to both filter and map elements from `iter`
1515+
/// An iterator that uses `f` to both filter and map elements from `iter`
15161516
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
15171517
#[stable]
15181518
pub struct FilterMap<A, B, I, F> where I: Iterator<A>, F: FnMut(A) -> Option<B> {
@@ -1573,7 +1573,7 @@ impl<A, B, I, F> DoubleEndedIterator<B> for FilterMap<A, B, I, F> where
15731573
}
15741574
}
15751575

1576-
/// An iterator which yields the current count and the element during iteration
1576+
/// An iterator that yields the current count and the element during iteration
15771577
#[deriving(Clone)]
15781578
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
15791579
#[stable]
@@ -1687,7 +1687,7 @@ impl<'a, A, T: Iterator<A>> Peekable<A, T> {
16871687
}
16881688
}
16891689

1690-
/// An iterator which rejects elements while `predicate` is true
1690+
/// An iterator that rejects elements while `predicate` is true
16911691
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
16921692
#[stable]
16931693
pub struct SkipWhile<A, I, P> where I: Iterator<A>, P: FnMut(&A) -> bool {
@@ -1730,7 +1730,7 @@ impl<A, I, P> Iterator<A> for SkipWhile<A, I, P> where I: Iterator<A>, P: FnMut(
17301730
}
17311731
}
17321732

1733-
/// An iterator which only accepts elements while `predicate` is true
1733+
/// An iterator that only accepts elements while `predicate` is true
17341734
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
17351735
#[stable]
17361736
pub struct TakeWhile<A, I, P> where I: Iterator<A>, P: FnMut(&A) -> bool {
@@ -1781,7 +1781,7 @@ impl<A, I, P> Iterator<A> for TakeWhile<A, I, P> where I: Iterator<A>, P: FnMut(
17811781
}
17821782
}
17831783

1784-
/// An iterator which skips over `n` elements of `iter`.
1784+
/// An iterator that skips over `n` elements of `iter`.
17851785
#[deriving(Clone)]
17861786
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
17871787
#[stable]
@@ -1849,7 +1849,7 @@ impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Skip<T> {
18491849
}
18501850
}
18511851

1852-
/// An iterator which only iterates over the first `n` iterations of `iter`.
1852+
/// An iterator that only iterates over the first `n` iterations of `iter`.
18531853
#[deriving(Clone)]
18541854
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
18551855
#[stable]
@@ -2186,7 +2186,7 @@ impl<A, I, F> RandomAccessIterator<A> for Inspect<A, I, F> where
21862186
}
21872187
}
21882188

2189-
/// An iterator which passes mutable state to a closure and yields the result.
2189+
/// An iterator that passes mutable state to a closure and yields the result.
21902190
///
21912191
/// # Example: The Fibonacci Sequence
21922192
///

src/librand/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -185,7 +185,7 @@ pub trait Rng {
185185
Rand::rand(self)
186186
}
187187

188-
/// Return an iterator which will yield an infinite number of randomly
188+
/// Return an iterator that will yield an infinite number of randomly
189189
/// generated items.
190190
///
191191
/// # Example

src/libstd/comm/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
//! Shared usage:
8282
//!
8383
//! ```
84-
//! // Create a shared channel which can be sent along from many tasks
84+
//! // Create a shared channel that can be sent along from many tasks
8585
//! // where tx is the sending half (tx for transmission), and rx is the receiving
8686
//! // half (rx for receiving).
8787
//! let (tx, rx) = channel();
@@ -176,7 +176,7 @@
176176
// The choice of implementation of all channels is to be built on lock-free data
177177
// structures. The channels themselves are then consequently also lock-free data
178178
// structures. As always with lock-free code, this is a very "here be dragons"
179-
// territory, especially because I'm unaware of any academic papers which have
179+
// territory, especially because I'm unaware of any academic papers that have
180180
// gone into great length about channels of these flavors.
181181
//
182182
// ## Flavors of channels
@@ -190,7 +190,7 @@
190190
// They contain as few atomics as possible and involve one and
191191
// exactly one allocation.
192192
// * Streams - these channels are optimized for the non-shared use case. They
193-
// use a different concurrent queue which is more tailored for this
193+
// use a different concurrent queue that is more tailored for this
194194
// use case. The initial allocation of this flavor of channel is not
195195
// optimized.
196196
// * Shared - this is the most general form of channel that this module offers,
@@ -205,7 +205,7 @@
205205
// shared and concurrent queue holding all of the actual data.
206206
//
207207
// With two flavors of channels, two flavors of queues are also used. We have
208-
// chosen to use queues from a well-known author which are abbreviated as SPSC
208+
// chosen to use queues from a well-known author that are abbreviated as SPSC
209209
// and MPSC (single producer, single consumer and multiple producer, single
210210
// consumer). SPSC queues are used for streams while MPSC queues are used for
211211
// shared channels.
@@ -309,7 +309,7 @@
309309
//
310310
// Sadly this current implementation requires multiple allocations, so I have
311311
// seen the throughput of select() be much worse than it should be. I do not
312-
// believe that there is anything fundamental which needs to change about these
312+
// believe that there is anything fundamental that needs to change about these
313313
// channels, however, in order to support a more efficient select().
314314
//
315315
// # Conclusion
@@ -910,7 +910,7 @@ impl<T: Send> Receiver<T> {
910910
}
911911
}
912912

913-
/// Returns an iterator which will block waiting for messages, but never
913+
/// Returns an iterator that will block waiting for messages, but never
914914
/// `panic!`. It will return `None` when the channel has hung up.
915915
#[unstable]
916916
pub fn iter<'a>(&'a self) -> Messages<'a, T> {

src/libstd/io/fs.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl File {
200200
.update_desc("couldn't create file")
201201
}
202202

203-
/// Returns the original path which was used to open this file.
203+
/// Returns the original path that was used to open this file.
204204
pub fn path<'a>(&'a self) -> &'a Path {
205205
&self.path
206206
}
@@ -215,7 +215,7 @@ impl File {
215215
}
216216

217217
/// This function is similar to `fsync`, except that it may not synchronize
218-
/// file metadata to the filesystem. This is intended for use case which
218+
/// file metadata to the filesystem. This is intended for use cases that
219219
/// must synchronize content, but don't need the metadata on disk. The goal
220220
/// of this method is to reduce disk operations.
221221
pub fn datasync(&mut self) -> IoResult<()> {
@@ -456,7 +456,7 @@ pub fn symlink(src: &Path, dst: &Path) -> IoResult<()> {
456456
/// # Error
457457
///
458458
/// This function will return an error on failure. Failure conditions include
459-
/// reading a file that does not exist or reading a file which is not a symlink.
459+
/// reading a file that does not exist or reading a file that is not a symlink.
460460
pub fn readlink(path: &Path) -> IoResult<Path> {
461461
fs_imp::readlink(path)
462462
.update_err("couldn't resolve symlink for path", |e|
@@ -546,7 +546,7 @@ pub fn readdir(path: &Path) -> IoResult<Vec<Path>> {
546546
|e| format!("{}; path={}", e, path.display()))
547547
}
548548

549-
/// Returns an iterator which will recursively walk the directory structure
549+
/// Returns an iterator that will recursively walk the directory structure
550550
/// rooted at `path`. The path given will not be iterated over, and this will
551551
/// perform iteration in some top-down order. The contents of unreadable
552552
/// subdirectories are ignored.
@@ -557,7 +557,7 @@ pub fn walk_dir(path: &Path) -> IoResult<Directories> {
557557
})
558558
}
559559

560-
/// An iterator which walks over a directory
560+
/// An iterator that walks over a directory
561561
pub struct Directories {
562562
stack: Vec<Path>,
563563
}

0 commit comments

Comments
 (0)