From 2f9ddf3bc7cfa79d272b1409be80905be946d831 Mon Sep 17 00:00:00 2001 From: Frank Steffahn Date: Sun, 22 Aug 2021 18:15:49 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20typos=20=E2=80=9Can=E2=80=9D=E2=86=92?= =?UTF-8?q?=E2=80=9Ca=E2=80=9D=20and=20a=20few=20different=20ones=20that?= =?UTF-8?q?=20appeared=20in=20the=20same=20search?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compiler/rustc_codegen_llvm/src/intrinsic.rs | 2 +- compiler/rustc_hir/src/hir.rs | 2 +- compiler/rustc_lint_defs/src/builtin.rs | 2 +- compiler/rustc_metadata/src/rmeta/decoder.rs | 2 +- compiler/rustc_middle/src/mir/interpret/value.rs | 10 +++++----- compiler/rustc_middle/src/mir/tcx.rs | 2 +- compiler/rustc_middle/src/mir/visit.rs | 2 +- compiler/rustc_middle/src/query/mod.rs | 2 +- compiler/rustc_middle/src/ty/closure.rs | 2 +- compiler/rustc_middle/src/ty/codec.rs | 4 ++-- compiler/rustc_middle/src/ty/sty.rs | 2 +- compiler/rustc_mir/src/interpret/validity.rs | 2 +- compiler/rustc_mir/src/transform/const_prop.rs | 2 +- compiler/rustc_mir/src/transform/rustc_peek.rs | 2 +- compiler/rustc_mir_build/src/build/expr/into.rs | 2 +- compiler/rustc_mir_build/src/thir/cx/expr.rs | 2 +- compiler/rustc_span/src/source_map.rs | 2 +- compiler/rustc_typeck/src/check_unused.rs | 2 +- library/alloc/src/collections/binary_heap.rs | 2 +- library/core/src/intrinsics.rs | 2 +- library/core/src/mem/mod.rs | 2 +- library/core/src/ptr/mod.rs | 6 +++--- library/std/src/ffi/mod.rs | 2 +- library/std/src/io/mod.rs | 2 +- library/std/src/keyword_docs.rs | 2 +- library/std/src/sys/windows/stdio.rs | 2 +- library/std/src/sys_common/wtf8.rs | 2 +- library/std/src/time/monotonic.rs | 2 +- src/test/mir-opt/dest-prop/copy_propagation_arg.rs | 2 +- .../ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs | 2 +- src/tools/clippy/clippy_lints/src/ptr_eq.rs | 2 +- src/tools/rustfmt/src/macros.rs | 2 +- src/tools/rustfmt/src/string.rs | 2 +- .../rustfmt/tests/source/cfg_if/detect/arch/x86.rs | 2 +- .../rustfmt/tests/target/cfg_if/detect/arch/x86.rs | 2 +- src/tools/tidy/src/style.rs | 2 +- 36 files changed, 43 insertions(+), 43 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index f7793c58a37..e30c49295ba 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -1031,7 +1031,7 @@ fn generic_simd_intrinsic( // vector mask and returns an unsigned integer containing the most // significant bit (MSB) of each lane. - // If the vector has less than 8 lanes, an u8 is returned with zeroed + // If the vector has less than 8 lanes, a u8 is returned with zeroed // trailing bits. let expected_int_bits = in_len.max(8); match ret_ty.kind() { diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index e36dbc7fc62..888d1c1832b 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -974,7 +974,7 @@ pub enum PatKind<'hir> { /// Invariant: `pats.len() >= 2`. Or(&'hir [Pat<'hir>]), - /// A path pattern for an unit struct/variant or a (maybe-associated) constant. + /// A path pattern for a unit struct/variant or a (maybe-associated) constant. Path(QPath<'hir>), /// A tuple pattern (e.g., `(a, b)`). diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 467ec73663b..ef08189a722 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -3371,7 +3371,7 @@ declare_lint! { } declare_lint! { - /// The `unsupported_calling_conventions` lint is output whenever there is an use of the + /// The `unsupported_calling_conventions` lint is output whenever there is a use of the /// `stdcall`, `fastcall`, `thiscall`, `vectorcall` calling conventions (or their unwind /// variants) on targets that cannot meaningfully be supported for the requested target. /// diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index 8bdd4313de4..4e591b28f60 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -62,7 +62,7 @@ crate struct CrateMetadata { // --- Some data pre-decoded from the metadata blob, usually for performance --- /// Properties of the whole crate. /// NOTE(eddyb) we pass `'static` to a `'tcx` parameter because this - /// lifetime is only used behind `Lazy`, and therefore acts like an + /// lifetime is only used behind `Lazy`, and therefore acts like a /// universal (`for<'tcx>`), that is paired up with whichever `TyCtxt` /// is being used to decode those values. root: CrateRoot<'static>, diff --git a/compiler/rustc_middle/src/mir/interpret/value.rs b/compiler/rustc_middle/src/mir/interpret/value.rs index 1783a40e126..cc31d8c2c18 100644 --- a/compiler/rustc_middle/src/mir/interpret/value.rs +++ b/compiler/rustc_middle/src/mir/interpret/value.rs @@ -376,27 +376,27 @@ impl<'tcx, Tag: Provenance> Scalar { self.to_bits(sz) } - /// Converts the scalar to produce an `u8`. Fails if the scalar is a pointer. + /// Converts the scalar to produce a `u8`. Fails if the scalar is a pointer. pub fn to_u8(self) -> InterpResult<'static, u8> { self.to_unsigned_with_bit_width(8).map(|v| u8::try_from(v).unwrap()) } - /// Converts the scalar to produce an `u16`. Fails if the scalar is a pointer. + /// Converts the scalar to produce a `u16`. Fails if the scalar is a pointer. pub fn to_u16(self) -> InterpResult<'static, u16> { self.to_unsigned_with_bit_width(16).map(|v| u16::try_from(v).unwrap()) } - /// Converts the scalar to produce an `u32`. Fails if the scalar is a pointer. + /// Converts the scalar to produce a `u32`. Fails if the scalar is a pointer. pub fn to_u32(self) -> InterpResult<'static, u32> { self.to_unsigned_with_bit_width(32).map(|v| u32::try_from(v).unwrap()) } - /// Converts the scalar to produce an `u64`. Fails if the scalar is a pointer. + /// Converts the scalar to produce a `u64`. Fails if the scalar is a pointer. pub fn to_u64(self) -> InterpResult<'static, u64> { self.to_unsigned_with_bit_width(64).map(|v| u64::try_from(v).unwrap()) } - /// Converts the scalar to produce an `u128`. Fails if the scalar is a pointer. + /// Converts the scalar to produce a `u128`. Fails if the scalar is a pointer. pub fn to_u128(self) -> InterpResult<'static, u128> { self.to_unsigned_with_bit_width(128) } diff --git a/compiler/rustc_middle/src/mir/tcx.rs b/compiler/rustc_middle/src/mir/tcx.rs index 6e819145976..74d303cee5d 100644 --- a/compiler/rustc_middle/src/mir/tcx.rs +++ b/compiler/rustc_middle/src/mir/tcx.rs @@ -265,7 +265,7 @@ impl BorrowKind { BorrowKind::Shared => hir::Mutability::Not, // We have no type corresponding to a unique imm borrow, so - // use `&mut`. It gives all the capabilities of an `&uniq` + // use `&mut`. It gives all the capabilities of a `&uniq` // and hence is a safe "over approximation". BorrowKind::Unique => hir::Mutability::Mut, diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs index 5516a045c1d..45ea3e3d9f3 100644 --- a/compiler/rustc_middle/src/mir/visit.rs +++ b/compiler/rustc_middle/src/mir/visit.rs @@ -1202,7 +1202,7 @@ pub enum NonUseContext { StorageDead, /// User type annotation assertions for NLL. AscribeUserTy, - /// The data of an user variable, for debug info. + /// The data of a user variable, for debug info. VarDebugInfo, } diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 551b2914682..68de7f29193 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -1733,7 +1733,7 @@ rustc_queries! { } /// Performs an HIR-based well-formed check on the item with the given `HirId`. If - /// we get an `Umimplemented` error that matches the provided `Predicate`, return + /// we get an `Unimplemented` error that matches the provided `Predicate`, return /// the cause of the newly created obligation. /// /// This is only used by error-reporting code to get a better cause (in particular, a better diff --git a/compiler/rustc_middle/src/ty/closure.rs b/compiler/rustc_middle/src/ty/closure.rs index dd6ca9bd8c8..4eacb3c4176 100644 --- a/compiler/rustc_middle/src/ty/closure.rs +++ b/compiler/rustc_middle/src/ty/closure.rs @@ -434,7 +434,7 @@ impl BorrowKind { ImmBorrow => hir::Mutability::Not, // We have no type corresponding to a unique imm borrow, so - // use `&mut`. It gives all the capabilities of an `&uniq` + // use `&mut`. It gives all the capabilities of a `&uniq` // and hence is a safe "over approximation". UniqueImmBorrow => hir::Mutability::Mut, } diff --git a/compiler/rustc_middle/src/ty/codec.rs b/compiler/rustc_middle/src/ty/codec.rs index fb13614e4b3..36db258e92d 100644 --- a/compiler/rustc_middle/src/ty/codec.rs +++ b/compiler/rustc_middle/src/ty/codec.rs @@ -209,7 +209,7 @@ where impl<'tcx, D: TyDecoder<'tcx>> Decodable for Ty<'tcx> { #[allow(rustc::usage_of_ty_tykind)] fn decode(decoder: &mut D) -> Result, D::Error> { - // Handle shorthands first, if we have an usize > 0x80. + // Handle shorthands first, if we have a usize > 0x80. if decoder.positioned_at_shorthand() { let pos = decoder.read_usize()?; assert!(pos >= SHORTHAND_OFFSET); @@ -228,7 +228,7 @@ impl<'tcx, D: TyDecoder<'tcx>> Decodable for Ty<'tcx> { impl<'tcx, D: TyDecoder<'tcx>> Decodable for ty::Binder<'tcx, ty::PredicateKind<'tcx>> { fn decode(decoder: &mut D) -> Result>, D::Error> { let bound_vars = Decodable::decode(decoder)?; - // Handle shorthands first, if we have an usize > 0x80. + // Handle shorthands first, if we have a usize > 0x80. Ok(ty::Binder::bind_with_vars( if decoder.positioned_at_shorthand() { let pos = decoder.read_usize()?; diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index b8dae502d7a..8e0a2d4a28d 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -239,7 +239,7 @@ static_assert_size!(TyKind<'_>, 32); /// implements `CK<(u32, u32), Output = u32>`, where `CK` is the trait /// specified above. /// - U is a type parameter representing the types of its upvars, tupled up -/// (borrowed, if appropriate; that is, if an U field represents a by-ref upvar, +/// (borrowed, if appropriate; that is, if a U field represents a by-ref upvar, /// and the up-var has the type `Foo`, then that field of U will be `&Foo`). /// /// So, for example, given this function: diff --git a/compiler/rustc_mir/src/interpret/validity.rs b/compiler/rustc_mir/src/interpret/validity.rs index 0c7f89c1a36..b0cd6405eb9 100644 --- a/compiler/rustc_mir/src/interpret/validity.rs +++ b/compiler/rustc_mir/src/interpret/validity.rs @@ -857,7 +857,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M> // types above, in `visit_primitive`. // In run-time mode, we accept pointers in here. This is actually more // permissive than a per-element check would be, e.g., we accept - // an &[u8] that contains a pointer even though bytewise checking would + // a &[u8] that contains a pointer even though bytewise checking would // reject it. However, that's good: We don't inherently want // to reject those pointers, we just do not have the machinery to // talk about parts of a pointer. diff --git a/compiler/rustc_mir/src/transform/const_prop.rs b/compiler/rustc_mir/src/transform/const_prop.rs index e02e41d6206..4578f04c034 100644 --- a/compiler/rustc_mir/src/transform/const_prop.rs +++ b/compiler/rustc_mir/src/transform/const_prop.rs @@ -145,7 +145,7 @@ impl<'tcx> MirPass<'tcx> for ConstProp { // FIXME(oli-obk, eddyb) Optimize locals (or even local paths) to hold // constants, instead of just checking for const-folding succeeding. - // That would require an uniform one-def no-mutation analysis + // That would require a uniform one-def no-mutation analysis // and RPO (or recursing when needing the value of a local). let mut optimization_finder = ConstPropagator::new(body, dummy_body, tcx); optimization_finder.visit_body(body); diff --git a/compiler/rustc_mir/src/transform/rustc_peek.rs b/compiler/rustc_mir/src/transform/rustc_peek.rs index e7157855cb4..f4a1b0ddba5 100644 --- a/compiler/rustc_mir/src/transform/rustc_peek.rs +++ b/compiler/rustc_mir/src/transform/rustc_peek.rs @@ -92,7 +92,7 @@ impl<'tcx> MirPass<'tcx> for SanityCheck { /// "rustc_peek: bit not set". /// /// The intention is that one can write unit tests for dataflow by -/// putting code into an UI test and using `rustc_peek` to +/// putting code into a UI test and using `rustc_peek` to /// make observations about the results of dataflow static analyses. /// /// (If there are any calls to `rustc_peek` that do not match the diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index aa2963c53f4..21c5a64f823 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -208,7 +208,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ); this.diverge_from(loop_block); - // The “return” value of the loop body must always be an unit. We therefore + // The “return” value of the loop body must always be a unit. We therefore // introduce a unit temporary as the destination for the loop body. let tmp = this.get_unit_temp(); // Execute the body, branching back to the test. diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs index 6bbf1faf483..f1d882e1ddd 100644 --- a/compiler/rustc_mir_build/src/thir/cx/expr.rs +++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs @@ -788,7 +788,7 @@ impl<'tcx> Cx<'tcx> { self.user_substs_applied_to_ty_of_hir_id(hir_id) } - // `Self` is used in expression as a tuple struct constructor or an unit struct constructor + // `Self` is used in expression as a tuple struct constructor or a unit struct constructor Res::SelfCtor(_) => self.user_substs_applied_to_ty_of_hir_id(hir_id), _ => bug!("user_substs_applied_to_res: unexpected res {:?} at {:?}", res, hir_id), diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index 77a3ad931d5..f700397fcdf 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -100,7 +100,7 @@ pub trait FileLoader { /// Query the existence of a file. fn file_exists(&self, path: &Path) -> bool; - /// Read the contents of an UTF-8 file into memory. + /// Read the contents of a UTF-8 file into memory. fn read_file(&self, path: &Path) -> io::Result; } diff --git a/compiler/rustc_typeck/src/check_unused.rs b/compiler/rustc_typeck/src/check_unused.rs index 7e5cc771b31..95d3bb11723 100644 --- a/compiler/rustc_typeck/src/check_unused.rs +++ b/compiler/rustc_typeck/src/check_unused.rs @@ -155,7 +155,7 @@ fn unused_crates_lint(tcx: TyCtxt<'_>) { } // If the extern crate isn't in the extern prelude, - // there is no way it can be written as an `use`. + // there is no way it can be written as a `use`. let orig_name = extern_crate.orig_name.unwrap_or(item.ident.name); if !extern_prelude.get(&orig_name).map_or(false, |from_item| !from_item) { continue; diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs index fb340734e0b..28e4f8bba05 100644 --- a/library/alloc/src/collections/binary_heap.rs +++ b/library/alloc/src/collections/binary_heap.rs @@ -46,7 +46,7 @@ //! } //! } //! -//! // Each node is represented as an `usize`, for a shorter implementation. +//! // Each node is represented as a `usize`, for a shorter implementation. //! struct Edge { //! node: usize, //! cost: usize, diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 272b1e3a1d7..9278dbb5498 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -1013,7 +1013,7 @@ extern "rust-intrinsic" { /// let val_casts = unsafe { &mut *(ptr as *mut i32 as *mut u32) }; /// ``` /// - /// Turning an `&str` into an `&[u8]`: + /// Turning an `&str` into a `&[u8]`: /// /// ``` /// // this is not a good way to do this. diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index d6eb535fd2e..84fd1a532c1 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -660,7 +660,7 @@ pub unsafe fn zeroed() -> T { #[rustc_diagnostic_item = "mem_uninitialized"] #[track_caller] pub unsafe fn uninitialized() -> T { - // SAFETY: the caller must guarantee that an unitialized value is valid for `T`. + // SAFETY: the caller must guarantee that an uninitialized value is valid for `T`. unsafe { intrinsics::assert_uninit_valid::(); MaybeUninit::uninit().assume_init() diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 47fad15e333..02c9dadc086 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -767,7 +767,7 @@ pub const unsafe fn read(src: *const T) -> T { /// /// # Examples /// -/// Read an usize value from a byte buffer: +/// Read a usize value from a byte buffer: /// /// ``` /// use std::mem; @@ -960,7 +960,7 @@ pub const unsafe fn write(dst: *mut T, src: T) { /// /// # Examples /// -/// Write an usize value to a byte buffer: +/// Write a usize value to a byte buffer: /// /// ``` /// use std::mem; @@ -1232,7 +1232,7 @@ pub(crate) unsafe fn align_offset(p: *const T, a: usize) -> usize { let smoda = stride & a_minus_one; // SAFETY: a is power-of-two hence non-zero. stride == 0 case is handled above. let gcdpow = unsafe { intrinsics::cttz_nonzero(stride).min(intrinsics::cttz_nonzero(a)) }; - // SAFETY: gcdpow has an upper-bound that’s at most the number of bits in an usize. + // SAFETY: gcdpow has an upper-bound that’s at most the number of bits in a usize. let gcd = unsafe { unchecked_shl(1usize, gcdpow) }; // SAFETY: gcd is always greater or equal to 1. diff --git a/library/std/src/ffi/mod.rs b/library/std/src/ffi/mod.rs index 0b7dc256db8..fe4e3af91ad 100644 --- a/library/std/src/ffi/mod.rs +++ b/library/std/src/ffi/mod.rs @@ -94,7 +94,7 @@ //! //! * [`OsStr`] represents a borrowed reference to a string in a //! format that can be passed to the operating system. It can be -//! converted into an UTF-8 Rust string slice in a similar way to +//! converted into a UTF-8 Rust string slice in a similar way to //! [`OsString`]. //! //! # Conversions diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index fa073d080c6..28254fea0d3 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -1150,7 +1150,7 @@ impl<'a> DerefMut for IoSliceMut<'a> { /// A buffer type used with `Write::write_vectored`. /// -/// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be +/// It is semantically a wrapper around a `&[u8]`, but is guaranteed to be /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// Windows. #[stable(feature = "iovec", since = "1.36.0")] diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index 605bd33a4bf..749a441d182 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -2289,7 +2289,7 @@ mod dyn_keyword {} /// } /// /// let mut u = IntOrFloat { f: 1.0 }; -/// // Reading the fields of an union is always unsafe +/// // Reading the fields of a union is always unsafe /// assert_eq!(unsafe { u.i }, 1065353216); /// // Updating through any of the field will modify all of them /// u.i = 1073741824; diff --git a/library/std/src/sys/windows/stdio.rs b/library/std/src/sys/windows/stdio.rs index 1cf0e9f0cf1..6f2618c63b5 100644 --- a/library/std/src/sys/windows/stdio.rs +++ b/library/std/src/sys/windows/stdio.rs @@ -162,7 +162,7 @@ impl io::Read for Stdin { } let mut utf16_buf = [0u16; MAX_BUFFER_SIZE / 2]; - // In the worst case, an UTF-8 string can take 3 bytes for every `u16` of an UTF-16. So + // In the worst case, a UTF-8 string can take 3 bytes for every `u16` of a UTF-16. So // we can read at most a third of `buf.len()` chars and uphold the guarantee no data gets // lost. let amount = cmp::min(buf.len() / 3, utf16_buf.len()); diff --git a/library/std/src/sys_common/wtf8.rs b/library/std/src/sys_common/wtf8.rs index 1bd3cfd2200..9508bd7da59 100644 --- a/library/std/src/sys_common/wtf8.rs +++ b/library/std/src/sys_common/wtf8.rs @@ -785,7 +785,7 @@ pub fn is_code_point_boundary(slice: &Wtf8, index: usize) -> bool { /// Copied from core::str::raw::slice_unchecked #[inline] pub unsafe fn slice_unchecked(s: &Wtf8, begin: usize, end: usize) -> &Wtf8 { - // memory layout of an &[u8] and &Wtf8 are the same + // memory layout of a &[u8] and &Wtf8 are the same Wtf8::from_bytes_unchecked(slice::from_raw_parts(s.bytes.as_ptr().add(begin), end - begin)) } diff --git a/library/std/src/time/monotonic.rs b/library/std/src/time/monotonic.rs index 27fee6acff3..fa96b7abff6 100644 --- a/library/std/src/time/monotonic.rs +++ b/library/std/src/time/monotonic.rs @@ -84,7 +84,7 @@ pub mod inner { pub(super) fn monotonize(raw: time::Instant) -> time::Instant { let delta = raw.checked_sub_instant(&ZERO).unwrap(); // Split into seconds and nanos since Duration doesn't have a - // constructor that takes an u128 + // constructor that takes a u128 let secs = delta.as_secs() as u128; let nanos = delta.subsec_nanos() as u128; let timestamp: u128 = secs << 64 | nanos; diff --git a/src/test/mir-opt/dest-prop/copy_propagation_arg.rs b/src/test/mir-opt/dest-prop/copy_propagation_arg.rs index 41796247789..a5fb0f640b2 100644 --- a/src/test/mir-opt/dest-prop/copy_propagation_arg.rs +++ b/src/test/mir-opt/dest-prop/copy_propagation_arg.rs @@ -7,7 +7,7 @@ fn dummy(x: u8) -> u8 { // EMIT_MIR copy_propagation_arg.foo.DestinationPropagation.diff fn foo(mut x: u8) { - // calling `dummy` to make an use of `x` that copyprop cannot eliminate + // calling `dummy` to make a use of `x` that copyprop cannot eliminate x = dummy(x); // this will assign a local to `x` } diff --git a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs index 25f6490aa35..48b140d9174 100644 --- a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs +++ b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs @@ -1,6 +1,6 @@ // compile-flags: -Z unstable-options // NOTE: This test doesn't actually require `fulldeps` -// so we could instead use it as an `ui` test. +// so we could instead use it as a `ui` test. // // Considering that all other `internal-lints` are tested here // this seems like the cleaner solution though. diff --git a/src/tools/clippy/clippy_lints/src/ptr_eq.rs b/src/tools/clippy/clippy_lints/src/ptr_eq.rs index d6d7049fb61..3258c9fb3fe 100644 --- a/src/tools/clippy/clippy_lints/src/ptr_eq.rs +++ b/src/tools/clippy/clippy_lints/src/ptr_eq.rs @@ -74,7 +74,7 @@ impl LateLintPass<'_> for PtrEq { } } -// If the given expression is a cast to an usize, return the lhs of the cast +// If the given expression is a cast to a usize, return the lhs of the cast // E.g., `foo as *const _ as usize` returns `foo as *const _`. fn expr_as_cast_to_usize<'tcx>(cx: &LateContext<'tcx>, cast_expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> { if cx.typeck_results().expr_ty(cast_expr) == cx.tcx.types.usize { diff --git a/src/tools/rustfmt/src/macros.rs b/src/tools/rustfmt/src/macros.rs index c8ee590b6cc..a9bc89544d8 100644 --- a/src/tools/rustfmt/src/macros.rs +++ b/src/tools/rustfmt/src/macros.rs @@ -401,7 +401,7 @@ fn rewrite_macro_inner( handle_vec_semi(context, shape, arg_vec, macro_name, style) } else { // If we are rewriting `vec!` macro or other special macros, - // then we can rewrite this as an usual array literal. + // then we can rewrite this as a usual array literal. // Otherwise, we must preserve the original existence of trailing comma. let macro_name = ¯o_name.as_str(); let mut force_trailing_comma = if trailing_comma { diff --git a/src/tools/rustfmt/src/string.rs b/src/tools/rustfmt/src/string.rs index 0cb9d817ca2..64ae15672df 100644 --- a/src/tools/rustfmt/src/string.rs +++ b/src/tools/rustfmt/src/string.rs @@ -153,7 +153,7 @@ pub(crate) fn rewrite_string<'a>( wrap_str(result, fmt.config.max_width(), fmt.shape) } -/// Returns the index to the end of the URL if the split at index of the given string includes an +/// Returns the index to the end of the URL if the split at index of the given string includes a /// URL or alike. Otherwise, returns `None`. fn detect_url(s: &[&str], index: usize) -> Option { let start = match s[..=index].iter().rposition(|g| is_whitespace(g)) { diff --git a/src/tools/rustfmt/tests/source/cfg_if/detect/arch/x86.rs b/src/tools/rustfmt/tests/source/cfg_if/detect/arch/x86.rs index 50d5cfa87c4..4c71a2c6ab9 100644 --- a/src/tools/rustfmt/tests/source/cfg_if/detect/arch/x86.rs +++ b/src/tools/rustfmt/tests/source/cfg_if/detect/arch/x86.rs @@ -2,7 +2,7 @@ //! //! The features are detected using the `detect_features` function below. //! This function uses the CPUID instruction to read the feature flags from the -//! CPU and encodes them in an `usize` where each bit position represents +//! CPU and encodes them in a `usize` where each bit position represents //! whether a feature is available (bit is set) or unavaiable (bit is cleared). //! //! The enum `Feature` is used to map bit positions to feature names, and the diff --git a/src/tools/rustfmt/tests/target/cfg_if/detect/arch/x86.rs b/src/tools/rustfmt/tests/target/cfg_if/detect/arch/x86.rs index 9219a4a577f..b985dd8caa1 100644 --- a/src/tools/rustfmt/tests/target/cfg_if/detect/arch/x86.rs +++ b/src/tools/rustfmt/tests/target/cfg_if/detect/arch/x86.rs @@ -2,7 +2,7 @@ //! //! The features are detected using the `detect_features` function below. //! This function uses the CPUID instruction to read the feature flags from the -//! CPU and encodes them in an `usize` where each bit position represents +//! CPU and encodes them in a `usize` where each bit position represents //! whether a feature is available (bit is set) or unavaiable (bit is cleared). //! //! The enum `Feature` is used to map bit positions to feature names, and the diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index d8d3dc3ddb1..022a3dfde82 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -66,7 +66,7 @@ enum LIUState { EXP_END, } -/// Returns `true` if `line` appears to be a line comment containing an URL, +/// Returns `true` if `line` appears to be a line comment containing a URL, /// possibly with a Markdown link label in front, and nothing else. /// The Markdown link label, if present, may not contain whitespace. /// Lines of this form are allowed to be overlength, because Markdown