mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Fix typos “a”→“an”
This commit is contained in:
parent
5fec618d2e
commit
c86071898f
9 changed files with 9 additions and 9 deletions
|
@ -268,7 +268,7 @@ impl std::ops::Sub<&MinifyingSugg<'static>> for MinifyingSugg<'static> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// a wrapper around `MinifyingSugg`, which carries a operator like currying
|
/// a wrapper around `MinifyingSugg`, which carries an operator like currying
|
||||||
/// so that the suggested code become more efficient (e.g. `foo + -bar` `foo - bar`).
|
/// so that the suggested code become more efficient (e.g. `foo + -bar` `foo - bar`).
|
||||||
struct Offset {
|
struct Offset {
|
||||||
value: MinifyingSugg<'static>,
|
value: MinifyingSugg<'static>,
|
||||||
|
|
|
@ -293,7 +293,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst {
|
||||||
}) => {
|
}) => {
|
||||||
if_chain! {
|
if_chain! {
|
||||||
// Lint a trait impl item only when the definition is a generic type,
|
// Lint a trait impl item only when the definition is a generic type,
|
||||||
// assuming a assoc const is not meant to be a interior mutable type.
|
// assuming an assoc const is not meant to be an interior mutable type.
|
||||||
if let Some(of_trait_def_id) = of_trait_ref.trait_def_id();
|
if let Some(of_trait_def_id) = of_trait_ref.trait_def_id();
|
||||||
if let Some(of_assoc_item) = specialization_graph::Node::Trait(of_trait_def_id)
|
if let Some(of_assoc_item) = specialization_graph::Node::Trait(of_trait_def_id)
|
||||||
.item(cx.tcx, impl_item.ident, AssocKind::Const, of_trait_def_id);
|
.item(cx.tcx, impl_item.ident, AssocKind::Const, of_trait_def_id);
|
||||||
|
|
|
@ -51,7 +51,7 @@ declare_clippy_lint! {
|
||||||
///
|
///
|
||||||
/// ### Known problems
|
/// ### Known problems
|
||||||
/// Will add unnecessary pair of parentheses when the
|
/// Will add unnecessary pair of parentheses when the
|
||||||
/// expression is not wrapped in a pair but starts with a opening parenthesis
|
/// expression is not wrapped in a pair but starts with an opening parenthesis
|
||||||
/// and ends with a closing one.
|
/// and ends with a closing one.
|
||||||
/// I.e., `let _ = (f()+1)..(f()+1)` results in `let _ = ((f()+1)..=f())`.
|
/// I.e., `let _ = (f()+1)..(f()+1)` results in `let _ = ((f()+1)..=f())`.
|
||||||
///
|
///
|
||||||
|
|
|
@ -74,7 +74,7 @@ declare_clippy_lint! {
|
||||||
declare_clippy_lint! {
|
declare_clippy_lint! {
|
||||||
/// ### What it does
|
/// ### What it does
|
||||||
/// Checks for bindings that shadow other bindings already in
|
/// Checks for bindings that shadow other bindings already in
|
||||||
/// scope, either without a initialization or with one that does not even use
|
/// scope, either without an initialization or with one that does not even use
|
||||||
/// the original value.
|
/// the original value.
|
||||||
///
|
///
|
||||||
/// ### Why is this bad?
|
/// ### Why is this bad?
|
||||||
|
|
|
@ -198,7 +198,7 @@ define_Conf! {
|
||||||
(enum_variant_name_threshold: u64 = 3),
|
(enum_variant_name_threshold: u64 = 3),
|
||||||
/// Lint: LARGE_ENUM_VARIANT.
|
/// Lint: LARGE_ENUM_VARIANT.
|
||||||
///
|
///
|
||||||
/// The maximum size of a enum's variant to avoid box suggestion
|
/// The maximum size of an enum's variant to avoid box suggestion
|
||||||
(enum_variant_size_threshold: u64 = 200),
|
(enum_variant_size_threshold: u64 = 200),
|
||||||
/// Lint: VERBOSE_BIT_MASK.
|
/// Lint: VERBOSE_BIT_MASK.
|
||||||
///
|
///
|
||||||
|
|
|
@ -329,7 +329,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
|
||||||
vec.iter().map(|elem| self.expr(elem)).collect::<Option<_>>()
|
vec.iter().map(|elem| self.expr(elem)).collect::<Option<_>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Lookup a possibly constant expression from a `ExprKind::Path`.
|
/// Lookup a possibly constant expression from an `ExprKind::Path`.
|
||||||
fn fetch_path(&mut self, qpath: &QPath<'_>, id: HirId, ty: Ty<'tcx>) -> Option<Constant> {
|
fn fetch_path(&mut self, qpath: &QPath<'_>, id: HirId, ty: Ty<'tcx>) -> Option<Constant> {
|
||||||
let res = self.typeck_results.qpath_res(qpath, id);
|
let res = self.typeck_results.qpath_res(qpath, id);
|
||||||
match res {
|
match res {
|
||||||
|
|
|
@ -583,7 +583,7 @@ pub fn trait_ref_of_method<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Optio
|
||||||
/// For example, if `e` represents the `v[0].a.b[x]`
|
/// For example, if `e` represents the `v[0].a.b[x]`
|
||||||
/// this method will return a tuple, composed of a `Vec`
|
/// this method will return a tuple, composed of a `Vec`
|
||||||
/// containing the `Expr`s for `v[0], v[0].a, v[0].a.b, v[0].a.b[x]`
|
/// containing the `Expr`s for `v[0], v[0].a, v[0].a.b, v[0].a.b[x]`
|
||||||
/// and a `Expr` for root of them, `v`
|
/// and an `Expr` for root of them, `v`
|
||||||
fn projection_stack<'a, 'hir>(mut e: &'a Expr<'hir>) -> (Vec<&'a Expr<'hir>>, &'a Expr<'hir>) {
|
fn projection_stack<'a, 'hir>(mut e: &'a Expr<'hir>) -> (Vec<&'a Expr<'hir>>, &'a Expr<'hir>) {
|
||||||
let mut result = vec![];
|
let mut result = vec![];
|
||||||
let root = loop {
|
let root = loop {
|
||||||
|
|
|
@ -434,7 +434,7 @@ pub fn make_assoc(op: AssocOp, lhs: &Sugg<'_>, rhs: &Sugg<'_>) -> Sugg<'static>
|
||||||
matches!(op, AssocOp::ShiftLeft | AssocOp::ShiftRight)
|
matches!(op, AssocOp::ShiftLeft | AssocOp::ShiftRight)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if the operator is a arithmetic operator
|
/// Returns `true` if the operator is an arithmetic operator
|
||||||
/// (i.e., `+`, `-`, `*`, `/`, `%`).
|
/// (i.e., `+`, `-`, `*`, `/`, `%`).
|
||||||
fn is_arith(op: AssocOp) -> bool {
|
fn is_arith(op: AssocOp) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
|
|
|
@ -117,7 +117,7 @@ impl SelfType for AtomicUsize {
|
||||||
const WRAPPED_SELF: Option<Self> = Some(AtomicUsize::new(21)); //~ ERROR interior mutable
|
const WRAPPED_SELF: Option<Self> = Some(AtomicUsize::new(21)); //~ ERROR interior mutable
|
||||||
}
|
}
|
||||||
|
|
||||||
// Even though a constant contains a generic type, if it also have a interior mutable type,
|
// Even though a constant contains a generic type, if it also have an interior mutable type,
|
||||||
// it should be linted at the definition site.
|
// it should be linted at the definition site.
|
||||||
trait BothOfCellAndGeneric<T> {
|
trait BothOfCellAndGeneric<T> {
|
||||||
// this is a false negative in the current implementation.
|
// this is a false negative in the current implementation.
|
||||||
|
|
Loading…
Reference in a new issue