Skip to content

Commit ee89c08

Browse files
author
Alexander Regueiro
committed
Various minor/cosmetic improvements to code
1 parent 4a45578 commit ee89c08

File tree

457 files changed

+2341
-2317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

457 files changed

+2341
-2317
lines changed

src/bootstrap/builder.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ impl<'a> Builder<'a> {
793793
}
794794

795795
// Set a flag for `check` so that certain build scripts can do less work
796-
// (e.g. not building/requiring LLVM).
796+
// (e.g., not building/requiring LLVM).
797797
if cmd == "check" {
798798
cargo.env("RUST_CHECK", "1");
799799
}
@@ -923,12 +923,12 @@ impl<'a> Builder<'a> {
923923
cargo.env("RUSTC_FORCE_UNSTABLE", "1");
924924

925925
// Currently the compiler depends on crates from crates.io, and
926-
// then other crates can depend on the compiler (e.g. proc-macro
926+
// then other crates can depend on the compiler (e.g., proc-macro
927927
// crates). Let's say, for example that rustc itself depends on the
928928
// bitflags crate. If an external crate then depends on the
929929
// bitflags crate as well, we need to make sure they don't
930930
// conflict, even if they pick the same version of bitflags. We'll
931-
// want to make sure that e.g. a plugin and rustc each get their
931+
// want to make sure that e.g., a plugin and rustc each get their
932932
// own copy of bitflags.
933933

934934
// Cargo ensures that this works in general through the -C metadata

src/bootstrap/dist.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ impl Step for Mingw {
353353
/// Build the `rust-mingw` installer component.
354354
///
355355
/// This contains all the bits and pieces to run the MinGW Windows targets
356-
/// without any extra installed software (e.g. we bundle gcc, libraries, etc).
356+
/// without any extra installed software (e.g., we bundle gcc, libraries, etc).
357357
fn run(self, builder: &Builder) -> Option<PathBuf> {
358358
let host = self.host;
359359

src/bootstrap/flags.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`"
121121
opts.optopt("", "on-fail", "command to run on failure", "CMD");
122122
opts.optflag("", "dry-run", "dry run; don't build anything");
123123
opts.optopt("", "stage",
124-
"stage to build (indicates compiler to use/test, e.g. stage 0 uses the \
124+
"stage to build (indicates compiler to use/test, e.g., stage 0 uses the \
125125
bootstrap compiler, stage 1 the stage 0 rustc artifacts, etc.)",
126126
"N");
127127
opts.optmulti("", "keep-stage", "stage(s) to keep without recompiling \
128-
(pass multiple times to keep e.g. both stages 0 and 1)", "N");
128+
(pass multiple times to keep e.g., both stages 0 and 1)", "N");
129129
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
130130
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
131131
opts.optflag("h", "help", "print this help message");

src/bootstrap/job.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! Job management on Windows for bootstrapping
1212
//!
13-
//! Most of the time when you're running a build system (e.g. make) you expect
13+
//! Most of the time when you're running a build system (e.g., make) you expect
1414
//! Ctrl-C or abnormal termination to actually terminate the entire tree of
1515
//! process in play, not just the one at the top. This currently works "by
1616
//! default" on Unix platforms because Ctrl-C actually sends a signal to the
@@ -162,11 +162,11 @@ pub unsafe fn setup(build: &mut Build) {
162162
return
163163
}
164164

165-
// If we've got a parent process (e.g. the python script that called us)
165+
// If we've got a parent process (e.g., the python script that called us)
166166
// then move ownership of this job object up to them. That way if the python
167-
// script is killed (e.g. via ctrl-c) then we'll all be torn down.
167+
// script is killed (e.g., via ctrl-c) then we'll all be torn down.
168168
//
169-
// If we don't have a parent (e.g. this was run directly) then we
169+
// If we don't have a parent (e.g., this was run directly) then we
170170
// intentionally leak the job object handle. When our process exits
171171
// (normally or abnormally) it will close the handle implicitly, causing all
172172
// processes in the job to be cleaned up.
@@ -184,7 +184,7 @@ pub unsafe fn setup(build: &mut Build) {
184184

185185
// If this failed, well at least we tried! An example of DuplicateHandle
186186
// failing in the past has been when the wrong python2 package spawned this
187-
// build system (e.g. the `python2` package in MSYS instead of
187+
// build system (e.g., the `python2` package in MSYS instead of
188188
// `mingw-w64-x86_64-python2`. Not sure why it failed, but the "failure
189189
// mode" here is that we only clean everything up when the build system
190190
// dies, not when the python parent does, so not too bad.

src/bootstrap/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
//! However, compiletest itself tries to avoid running tests when the artifacts
3939
//! that are involved (mainly the compiler) haven't changed.
4040
//!
41-
//! When you execute `x.py build`, the steps which are executed are:
41+
//! When you execute `x.py build`, the steps executed are:
4242
//!
4343
//! * First, the python script is run. This will automatically download the
4444
//! stage0 rustc and cargo according to `src/stage0.txt`, or use the cached

src/bootstrap/native.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl Step for Llvm {
251251
configure_cmake(builder, target, &mut cfg, false);
252252

253253
// FIXME: we don't actually need to build all LLVM tools and all LLVM
254-
// libraries here, e.g. we just want a few components and a few
254+
// libraries here, e.g., we just want a few components and a few
255255
// tools. Figure out how to filter them down and only build the right
256256
// tools and libs on all platforms.
257257

src/bootstrap/test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ impl Step for Compiletest {
971971
}
972972

973973
if builder.no_std(target) == Some(true) {
974-
// for no_std run-make (e.g. thumb*),
974+
// for no_std run-make (e.g., thumb*),
975975
// we need a host compiler which is called by cargo.
976976
builder.ensure(compile::Std { compiler, target: compiler.host });
977977
}
@@ -1277,7 +1277,7 @@ impl Step for DocTest {
12771277

12781278
/// Run `rustdoc --test` for all documentation in `src/doc`.
12791279
///
1280-
/// This will run all tests in our markdown documentation (e.g. the book)
1280+
/// This will run all tests in our markdown documentation (e.g., the book)
12811281
/// located in `src/doc`. The `rustdoc` that's run is the one that sits next to
12821282
/// `compiler`.
12831283
fn run(self, builder: &Builder) {

src/bootstrap/tool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ impl<'a> Builder<'a> {
646646
self.cargo_out(compiler, tool.get_mode(), *host).join("deps"),
647647
];
648648

649-
// On MSVC a tool may invoke a C compiler (e.g. compiletest in run-make
649+
// On MSVC a tool may invoke a C compiler (e.g., compiletest in run-make
650650
// mode) and that C compiler may need some extra PATH modification. Do
651651
// so here.
652652
if compiler.host.contains("msvc") {

src/liballoc/boxed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ impl<T: ?Sized> AsMut<T> for Box<T> {
801801
* safe.)
802802
* - It is in practice very useful to have Box<T> be unconditionally
803803
* Unpin because of trait objects, for which the structural auto
804-
* trait functionality does not apply (e.g. Box<dyn Foo> would
804+
* trait functionality does not apply (e.g., Box<dyn Foo> would
805805
* otherwise not be Unpin).
806806
*
807807
* Another type with the same semantics as Box but only a conditional

src/liballoc/collections/binary_heap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ impl<T: Ord> BinaryHeap<T> {
858858
}
859859
}
860860

861-
/// Hole represents a hole in a slice i.e. an index without valid value
861+
/// Hole represents a hole in a slice i.e., an index without valid value
862862
/// (because it was moved from or duplicated).
863863
/// In drop, `Hole` will restore the slice by filling the hole
864864
/// position with the value that was originally removed.

src/liballoc/collections/btree/set.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ impl<T: Ord> BTreeSet<T> {
258258
}
259259

260260
/// Visits the values representing the difference,
261-
/// i.e. the values that are in `self` but not in `other`,
261+
/// i.e., the values that are in `self` but not in `other`,
262262
/// in ascending order.
263263
///
264264
/// # Examples
@@ -286,7 +286,7 @@ impl<T: Ord> BTreeSet<T> {
286286
}
287287

288288
/// Visits the values representing the symmetric difference,
289-
/// i.e. the values that are in `self` or in `other` but not in both,
289+
/// i.e., the values that are in `self` or in `other` but not in both,
290290
/// in ascending order.
291291
///
292292
/// # Examples
@@ -316,7 +316,7 @@ impl<T: Ord> BTreeSet<T> {
316316
}
317317

318318
/// Visits the values representing the intersection,
319-
/// i.e. the values that are both in `self` and `other`,
319+
/// i.e., the values that are both in `self` and `other`,
320320
/// in ascending order.
321321
///
322322
/// # Examples
@@ -344,7 +344,7 @@ impl<T: Ord> BTreeSet<T> {
344344
}
345345

346346
/// Visits the values representing the union,
347-
/// i.e. all the values in `self` or `other`, without duplicates,
347+
/// i.e., all the values in `self` or `other`, without duplicates,
348348
/// in ascending order.
349349
///
350350
/// # Examples
@@ -455,7 +455,7 @@ impl<T: Ord> BTreeSet<T> {
455455
}
456456

457457
/// Returns `true` if the set is a subset of another,
458-
/// i.e. `other` contains at least all the values in `self`.
458+
/// i.e., `other` contains at least all the values in `self`.
459459
///
460460
/// # Examples
461461
///
@@ -498,7 +498,7 @@ impl<T: Ord> BTreeSet<T> {
498498
}
499499

500500
/// Returns `true` if the set is a superset of another,
501-
/// i.e. `self` contains at least all the values in `other`.
501+
/// i.e., `self` contains at least all the values in `other`.
502502
///
503503
/// # Examples
504504
///

src/liballoc/raw_vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ unsafe impl<#[may_dangle] T, A: Alloc> Drop for RawVec<T, A> {
739739
// On 64-bit we just need to check for overflow since trying to allocate
740740
// `> isize::MAX` bytes will surely fail. On 32-bit and 16-bit we need to add
741741
// an extra guard for this in case we're running on a platform which can use
742-
// all 4GB in user-space. e.g. PAE or x32
742+
// all 4GB in user-space. e.g., PAE or x32
743743

744744
#[inline]
745745
fn alloc_guard(alloc_size: usize) -> Result<(), CollectionAllocErr> {

src/liballoc/rc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ struct RcBox<T: ?Sized> {
276276
/// See the [module-level documentation](./index.html) for more details.
277277
///
278278
/// The inherent methods of `Rc` are all associated functions, which means
279-
/// that you have to call them as e.g. [`Rc::get_mut(&mut value)`][get_mut] instead of
279+
/// that you have to call them as e.g., [`Rc::get_mut(&mut value)`][get_mut] instead of
280280
/// `value.get_mut()`. This avoids conflicts with methods of the inner
281281
/// type `T`.
282282
///
@@ -1252,7 +1252,7 @@ impl<T: ?Sized> Weak<T> {
12521252
}
12531253

12541254
/// Return `None` when the pointer is dangling and there is no allocated `RcBox`,
1255-
/// i.e. this `Weak` was created by `Weak::new`
1255+
/// i.e., this `Weak` was created by `Weak::new`
12561256
#[inline]
12571257
fn inner(&self) -> Option<&RcBox<T>> {
12581258
if is_dangling(self.ptr) {

src/liballoc/slice.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ mod hack {
177177
impl<T> [T] {
178178
/// Sorts the slice.
179179
///
180-
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
180+
/// This sort is stable (i.e., does not reorder equal elements) and `O(n log n)` worst-case.
181181
///
182182
/// When applicable, unstable sorting is preferred because it is generally faster than stable
183183
/// sorting and it doesn't allocate auxiliary memory.
@@ -211,7 +211,7 @@ impl<T> [T] {
211211

212212
/// Sorts the slice with a comparator function.
213213
///
214-
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
214+
/// This sort is stable (i.e., does not reorder equal elements) and `O(n log n)` worst-case.
215215
///
216216
/// The comparator function must define a total ordering for the elements in the slice. If
217217
/// the ordering is not total, the order of the elements is unspecified. An order is a
@@ -264,7 +264,7 @@ impl<T> [T] {
264264

265265
/// Sorts the slice with a key extraction function.
266266
///
267-
/// This sort is stable (i.e. does not reorder equal elements) and `O(m n log(m n))`
267+
/// This sort is stable (i.e., does not reorder equal elements) and `O(m n log(m n))`
268268
/// worst-case, where the key function is `O(m)`.
269269
///
270270
/// When applicable, unstable sorting is preferred because it is generally faster than stable
@@ -301,10 +301,10 @@ impl<T> [T] {
301301
///
302302
/// During sorting, the key function is called only once per element.
303303
///
304-
/// This sort is stable (i.e. does not reorder equal elements) and `O(m n + n log n)`
304+
/// This sort is stable (i.e., does not reorder equal elements) and `O(m n + n log n)`
305305
/// worst-case, where the key function is `O(m)`.
306306
///
307-
/// For simple key functions (e.g. functions that are property accesses or
307+
/// For simple key functions (e.g., functions that are property accesses or
308308
/// basic operations), [`sort_by_key`](#method.sort_by_key) is likely to be
309309
/// faster.
310310
///

src/liballoc/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ impl<T: ?Sized> Weak<T> {
11211121
}
11221122

11231123
/// Return `None` when the pointer is dangling and there is no allocated `ArcInner`,
1124-
/// i.e. this `Weak` was created by `Weak::new`
1124+
/// i.e., this `Weak` was created by `Weak::new`
11251125
#[inline]
11261126
fn inner(&self) -> Option<&ArcInner<T>> {
11271127
if is_dangling(self.ptr) {

src/liballoc/tests/slice.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ fn test_sort_stability() {
484484
// create a vector like [(6, 1), (5, 1), (6, 2), ...],
485485
// where the first item of each tuple is random, but
486486
// the second item represents which occurrence of that
487-
// number this element is, i.e. the second elements
487+
// number this element is, i.e., the second elements
488488
// will occur in sorted order.
489489
let mut orig: Vec<_> = (0..len)
490490
.map(|_| {
@@ -502,7 +502,7 @@ fn test_sort_stability() {
502502
// This comparison includes the count (the second item
503503
// of the tuple), so elements with equal first items
504504
// will need to be ordered with increasing
505-
// counts... i.e. exactly asserting that this sort is
505+
// counts... i.e., exactly asserting that this sort is
506506
// stable.
507507
assert!(v.windows(2).all(|w| w[0] <= w[1]));
508508

@@ -1579,7 +1579,7 @@ macro_rules! test {
15791579
}).join();
15801580

15811581
// Check that the number of things dropped is exactly
1582-
// what we expect (i.e. the contents of `v`).
1582+
// what we expect (i.e., the contents of `v`).
15831583
for (i, c) in DROP_COUNTS.iter().enumerate().take(len) {
15841584
let count = c.load(Relaxed);
15851585
assert!(count == 1,

src/liballoc/tests/str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ fn test_escape_debug() {
10051005
// Note that there are subtleties with the number of backslashes
10061006
// on the left- and right-hand sides. In particular, Unicode code points
10071007
// are usually escaped with two backslashes on the right-hand side, as
1008-
// they are escaped. However, when the character is unescaped (e.g. for
1008+
// they are escaped. However, when the character is unescaped (e.g., for
10091009
// printable characters), only a single backslash appears (as the character
10101010
// itself appears in the debug string).
10111011
assert_eq!("abc".escape_debug(), "abc");

src/liballoc/vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ use raw_vec::RawVec;
213213
/// about its design. This ensures that it's as low-overhead as possible in
214214
/// the general case, and can be correctly manipulated in primitive ways
215215
/// by unsafe code. Note that these guarantees refer to an unqualified `Vec<T>`.
216-
/// If additional type parameters are added (e.g. to support custom allocators),
216+
/// If additional type parameters are added (e.g., to support custom allocators),
217217
/// overriding their defaults may change the behavior.
218218
///
219219
/// Most fundamentally, `Vec` is and always will be a (pointer, capacity, length)

0 commit comments

Comments
 (0)