Skip to content

Commit 4c847c0

Browse files
authored
Rollup merge of rust-lang#88230 - steffahn:a_an, r=oli-obk
Fix typos “a”→“an” Fix typos in comments; found using a regex to find some easy instance of incorrect usage of a vs. an. While automation was used to find these, every change was checked manually. Changes in submodules get separate PRs: * rust-lang/stdarch#1201 * rust-lang/cargo#9821 * rust-lang/miri#1874 * rust-lang/rls#1746 * rust-lang/rust-analyzer#9984 _folks @ rust-analyzer are fast at merging…_ * rust-lang/rust-analyzer#9985 * rust-lang/rust-analyzer#9987 * rust-lang/rust-analyzer#9989 _For `clippy`, I don’t know if the changes should better better be moved to a PR to the original repo._ <hr> This has some overlap with rust-lang#88226, but neither is a strict superset of the other. If you want multiple commits, I can split it up; in that case, make sure to suggest a criterion for splitting.
2 parents 5868e28 + 8b6529e commit 4c847c0

File tree

11 files changed

+13
-13
lines changed

11 files changed

+13
-13
lines changed

clippy_lints/src/formatting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ fn check_unop(cx: &EarlyContext<'_>, expr: &Expr) {
164164
if !differing_macro_contexts(lhs.span, rhs.span) && !lhs.span.from_expansion();
165165
// span between BinOp LHS and RHS
166166
let binop_span = lhs.span.between(rhs.span);
167-
// if RHS is a UnOp
167+
// if RHS is an UnOp
168168
if let ExprKind::Unary(op, ref un_rhs) = rhs.kind;
169169
// from UnOp operator to UnOp operand
170170
let unop_operand_span = rhs.span.until(un_rhs.span);

clippy_lints/src/loops/manual_memcpy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ impl std::ops::Sub<&MinifyingSugg<'static>> for MinifyingSugg<'static> {
268268
}
269269
}
270270

271-
/// a wrapper around `MinifyingSugg`, which carries a operator like currying
271+
/// a wrapper around `MinifyingSugg`, which carries an operator like currying
272272
/// so that the suggested code become more efficient (e.g. `foo + -bar` `foo - bar`).
273273
struct Offset {
274274
value: MinifyingSugg<'static>,

clippy_lints/src/non_copy_const.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn is_unfrozen<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
122122
// Ignore types whose layout is unknown since `is_freeze` reports every generic types as `!Freeze`,
123123
// making it indistinguishable from `UnsafeCell`. i.e. it isn't a tool to prove a type is
124124
// 'unfrozen'. However, this code causes a false negative in which
125-
// a type contains a layout-unknown type, but also a unsafe cell like `const CELL: Cell<T>`.
125+
// a type contains a layout-unknown type, but also an unsafe cell like `const CELL: Cell<T>`.
126126
// Yet, it's better than `ty.has_type_flags(TypeFlags::HAS_TY_PARAM | TypeFlags::HAS_PROJECTION)`
127127
// since it works when a pointer indirection involves (`Cell<*const T>`).
128128
// Making up a `ParamEnv` where every generic params and assoc types are `Freeze`is another option;
@@ -266,7 +266,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst {
266266
// in other words, lint consts whose value *could* be unfrozen, not definitely is.
267267
// This feels inconsistent with how the lint treats generic types,
268268
// which avoids linting types which potentially become unfrozen.
269-
// One could check whether a unfrozen type have a *frozen variant*
269+
// One could check whether an unfrozen type have a *frozen variant*
270270
// (like `body_id_opt.map_or_else(|| !has_frozen_variant(...), ...)`),
271271
// and do the same as the case of generic types at impl items.
272272
// Note that it isn't sufficient to check if it has an enum
@@ -293,7 +293,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst {
293293
}) => {
294294
if_chain! {
295295
// Lint a trait impl item only when the definition is a generic type,
296-
// assuming a assoc const is not meant to be a interior mutable type.
296+
// assuming an assoc const is not meant to be an interior mutable type.
297297
if let Some(of_trait_def_id) = of_trait_ref.trait_def_id();
298298
if let Some(of_assoc_item) = specialization_graph::Node::Trait(of_trait_def_id)
299299
.item(cx.tcx, impl_item.ident, AssocKind::Const, of_trait_def_id);

clippy_lints/src/ptr_eq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl LateLintPass<'_> for PtrEq {
7474
}
7575
}
7676

77-
// If the given expression is a cast to an usize, return the lhs of the cast
77+
// If the given expression is a cast to a usize, return the lhs of the cast
7878
// E.g., `foo as *const _ as usize` returns `foo as *const _`.
7979
fn expr_as_cast_to_usize<'tcx>(cx: &LateContext<'tcx>, cast_expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> {
8080
if cx.typeck_results().expr_ty(cast_expr) == cx.tcx.types.usize {

clippy_lints/src/ranges.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ declare_clippy_lint! {
5151
///
5252
/// ### Known problems
5353
/// Will add unnecessary pair of parentheses when the
54-
/// expression is not wrapped in a pair but starts with a opening parenthesis
54+
/// expression is not wrapped in a pair but starts with an opening parenthesis
5555
/// and ends with a closing one.
5656
/// I.e., `let _ = (f()+1)..(f()+1)` results in `let _ = ((f()+1)..=f())`.
5757
///

clippy_lints/src/shadow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ declare_clippy_lint! {
7474
declare_clippy_lint! {
7575
/// ### What it does
7676
/// Checks for bindings that shadow other bindings already in
77-
/// scope, either without a initialization or with one that does not even use
77+
/// scope, either without an initialization or with one that does not even use
7878
/// the original value.
7979
///
8080
/// ### Why is this bad?

clippy_lints/src/utils/conf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ define_Conf! {
198198
(enum_variant_name_threshold: u64 = 3),
199199
/// Lint: LARGE_ENUM_VARIANT.
200200
///
201-
/// The maximum size of a enum's variant to avoid box suggestion
201+
/// The maximum size of an enum's variant to avoid box suggestion
202202
(enum_variant_size_threshold: u64 = 200),
203203
/// Lint: VERBOSE_BIT_MASK.
204204
///

clippy_utils/src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
329329
vec.iter().map(|elem| self.expr(elem)).collect::<Option<_>>()
330330
}
331331

332-
/// Lookup a possibly constant expression from a `ExprKind::Path`.
332+
/// Lookup a possibly constant expression from an `ExprKind::Path`.
333333
fn fetch_path(&mut self, qpath: &QPath<'_>, id: HirId, ty: Ty<'tcx>) -> Option<Constant> {
334334
let res = self.typeck_results.qpath_res(qpath, id);
335335
match res {

clippy_utils/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ pub fn trait_ref_of_method<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Optio
587587
/// For example, if `e` represents the `v[0].a.b[x]`
588588
/// this method will return a tuple, composed of a `Vec`
589589
/// containing the `Expr`s for `v[0], v[0].a, v[0].a.b, v[0].a.b[x]`
590-
/// and a `Expr` for root of them, `v`
590+
/// and an `Expr` for root of them, `v`
591591
fn projection_stack<'a, 'hir>(mut e: &'a Expr<'hir>) -> (Vec<&'a Expr<'hir>>, &'a Expr<'hir>) {
592592
let mut result = vec![];
593593
let root = loop {

clippy_utils/src/sugg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ pub fn make_assoc(op: AssocOp, lhs: &Sugg<'_>, rhs: &Sugg<'_>) -> Sugg<'static>
434434
matches!(op, AssocOp::ShiftLeft | AssocOp::ShiftRight)
435435
}
436436

437-
/// Returns `true` if the operator is a arithmetic operator
437+
/// Returns `true` if the operator is an arithmetic operator
438438
/// (i.e., `+`, `-`, `*`, `/`, `%`).
439439
fn is_arith(op: AssocOp) -> bool {
440440
matches!(

tests/ui/declare_interior_mutable_const/traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl SelfType for AtomicUsize {
117117
const WRAPPED_SELF: Option<Self> = Some(AtomicUsize::new(21)); //~ ERROR interior mutable
118118
}
119119

120-
// Even though a constant contains a generic type, if it also have a interior mutable type,
120+
// Even though a constant contains a generic type, if it also have an interior mutable type,
121121
// it should be linted at the definition site.
122122
trait BothOfCellAndGeneric<T> {
123123
// this is a false negative in the current implementation.

0 commit comments

Comments
 (0)