From 88541d66370aba7ec48661617afd4d712f4e6711 Mon Sep 17 00:00:00 2001 From: Yuxiang Qiu Date: Tue, 2 Jan 2024 19:21:51 -0500 Subject: [PATCH] fix some typos --- book/src/development/macro_expansions.md | 2 +- clippy_lints/src/methods/mod.rs | 4 ++-- clippy_lints/src/missing_asserts_for_indexing.rs | 2 +- clippy_lints/src/no_effect.rs | 2 +- clippy_lints/src/serde_api.rs | 2 +- clippy_lints/src/wildcard_imports.rs | 2 +- clippy_utils/src/ty/type_certainty/mod.rs | 6 +++--- tests/ui/as_conversions.rs | 2 +- tests/ui/default_numeric_fallback_i32.fixed | 2 +- tests/ui/default_numeric_fallback_i32.rs | 2 +- tests/ui/redundant_as_str.fixed | 2 +- tests/ui/redundant_as_str.rs | 2 +- tests/ui/regex.rs | 2 +- tests/ui/struct_fields.rs | 2 +- tests/ui/useless_conversion.fixed | 4 ++-- tests/ui/useless_conversion.rs | 4 ++-- 16 files changed, 21 insertions(+), 21 deletions(-) diff --git a/book/src/development/macro_expansions.md b/book/src/development/macro_expansions.md index c5eb000272d..aecca9ef72e 100644 --- a/book/src/development/macro_expansions.md +++ b/book/src/development/macro_expansions.md @@ -102,7 +102,7 @@ let x: Option = Some(42); m!(x, x.unwrap()); ``` -If the `m!(x, x.unwrapp());` line is expanded, we would get two expanded +If the `m!(x, x.unwrap());` line is expanded, we would get two expanded expressions: - `x.is_some()` (from the `$a.is_some()` line in the `m` macro) diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index 4c21f49638b..fbca641cfa3 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -3786,7 +3786,7 @@ /// /// ### Why is this bad? /// This pattern is often followed by manual unwrapping of the `Option`. The simplification - /// results in more readable and succint code without the need for manual unwrapping. + /// results in more readable and succinct code without the need for manual unwrapping. /// /// ### Example /// ```no_run @@ -3812,7 +3812,7 @@ /// /// ### Why is this bad? /// This pattern is often followed by manual unwrapping of `Result`. The simplification - /// results in more readable and succint code without the need for manual unwrapping. + /// results in more readable and succinct code without the need for manual unwrapping. /// /// ### Example /// ```no_run diff --git a/clippy_lints/src/missing_asserts_for_indexing.rs b/clippy_lints/src/missing_asserts_for_indexing.rs index 0f18e943451..bbc4d0a0f9a 100644 --- a/clippy_lints/src/missing_asserts_for_indexing.rs +++ b/clippy_lints/src/missing_asserts_for_indexing.rs @@ -331,7 +331,7 @@ fn report_indexes(cx: &LateContext<'_>, map: &UnhashMap> slice, } if indexes.len() > 1 => { // if we have found an `assert!`, let's also check that it's actually right - // and if it convers the highest index and if not, suggest the correct length + // and if it covers the highest index and if not, suggest the correct length let sugg = match comparison { // `v.len() < 5` and `v.len() <= 5` does nothing in terms of bounds checks. // The user probably meant `v.len() > 5` diff --git a/clippy_lints/src/no_effect.rs b/clippy_lints/src/no_effect.rs index 5978da83199..6bbe427ea29 100644 --- a/clippy_lints/src/no_effect.rs +++ b/clippy_lints/src/no_effect.rs @@ -165,7 +165,7 @@ fn check_no_effect(cx: &LateContext<'_>, stmt: &Stmt<'_>) -> bool { } fn is_operator_overridden(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { - // It's very hard or impossable to check whether overridden operator have side-effect this lint. + // It's very hard or impossible to check whether overridden operator have side-effect this lint. // So, this function assume user-defined operator is overridden with an side-effect. // The definition of user-defined structure here is ADT-type, // Althrough this will weaken the ability of this lint, less error lint-fix happen. diff --git a/clippy_lints/src/serde_api.rs b/clippy_lints/src/serde_api.rs index 90834d784a5..b4278d879e5 100644 --- a/clippy_lints/src/serde_api.rs +++ b/clippy_lints/src/serde_api.rs @@ -6,7 +6,7 @@ declare_clippy_lint! { /// ### What it does - /// Checks for mis-uses of the serde API. + /// Checks for misuses of the serde API. /// /// ### Why is this bad? /// Serde is very finnicky about how its API should be diff --git a/clippy_lints/src/wildcard_imports.rs b/clippy_lints/src/wildcard_imports.rs index 9b0dac6af25..b82bd1d7e7c 100644 --- a/clippy_lints/src/wildcard_imports.rs +++ b/clippy_lints/src/wildcard_imports.rs @@ -142,7 +142,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) { } else { // In this case, the `use_path.span` ends right before the `::*`, so we need to // extend it up to the `*`. Since it is hard to find the `*` in weird - // formattings like `use _ :: *;`, we extend it up to, but not including the + // formatting like `use _ :: *;`, we extend it up to, but not including the // `;`. In nested imports, like `use _::{inner::*, _}` there is no `;` and we // can just use the end of the item span let mut span = use_path.span.with_hi(item.span.hi()); diff --git a/clippy_utils/src/ty/type_certainty/mod.rs b/clippy_utils/src/ty/type_certainty/mod.rs index da71fc3aaa8..adca2ca1c3e 100644 --- a/clippy_utils/src/ty/type_certainty/mod.rs +++ b/clippy_utils/src/ty/type_certainty/mod.rs @@ -38,7 +38,7 @@ fn expr_type_certainty(cx: &LateContext<'_>, expr: &Expr<'_>) -> Certainty { ExprKind::Call(callee, args) => { let lhs = expr_type_certainty(cx, callee); - let rhs = if type_is_inferrable_from_arguments(cx, expr) { + let rhs = if type_is_inferable_from_arguments(cx, expr) { meet(args.iter().map(|arg| expr_type_certainty(cx, arg))) } else { Certainty::Uncertain @@ -57,7 +57,7 @@ fn expr_type_certainty(cx: &LateContext<'_>, expr: &Expr<'_>) -> Certainty { receiver_type_certainty = receiver_type_certainty.with_def_id(self_ty_def_id); }; let lhs = path_segment_certainty(cx, receiver_type_certainty, method, false); - let rhs = if type_is_inferrable_from_arguments(cx, expr) { + let rhs = if type_is_inferable_from_arguments(cx, expr) { meet( std::iter::once(receiver_type_certainty).chain(args.iter().map(|arg| expr_type_certainty(cx, arg))), ) @@ -279,7 +279,7 @@ fn update_res(cx: &LateContext<'_>, parent_certainty: Certainty, path_segment: & } #[allow(clippy::cast_possible_truncation)] -fn type_is_inferrable_from_arguments(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { +fn type_is_inferable_from_arguments(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { let Some(callee_def_id) = (match expr.kind { ExprKind::Call(callee, _) => { let callee_ty = cx.typeck_results().expr_ty(callee); diff --git a/tests/ui/as_conversions.rs b/tests/ui/as_conversions.rs index 192eb51ea99..8499c0ac5a0 100644 --- a/tests/ui/as_conversions.rs +++ b/tests/ui/as_conversions.rs @@ -17,7 +17,7 @@ fn main() { with_span!( span - fn coverting() { + fn converting() { let x = 0u32 as u64; } ); diff --git a/tests/ui/default_numeric_fallback_i32.fixed b/tests/ui/default_numeric_fallback_i32.fixed index 9ef92d8f279..c364c683057 100644 --- a/tests/ui/default_numeric_fallback_i32.fixed +++ b/tests/ui/default_numeric_fallback_i32.fixed @@ -184,7 +184,7 @@ fn check_expect_suppression() { let x = 21; } -mod type_already_infered { +mod type_already_inferred { // Should NOT lint if bound to return type fn ret_i32() -> i32 { 1 diff --git a/tests/ui/default_numeric_fallback_i32.rs b/tests/ui/default_numeric_fallback_i32.rs index 4b54b8d8458..ffa7b961d1c 100644 --- a/tests/ui/default_numeric_fallback_i32.rs +++ b/tests/ui/default_numeric_fallback_i32.rs @@ -184,7 +184,7 @@ fn check_expect_suppression() { let x = 21; } -mod type_already_infered { +mod type_already_inferred { // Should NOT lint if bound to return type fn ret_i32() -> i32 { 1 diff --git a/tests/ui/redundant_as_str.fixed b/tests/ui/redundant_as_str.fixed index a38523a7c79..4185b402226 100644 --- a/tests/ui/redundant_as_str.fixed +++ b/tests/ui/redundant_as_str.fixed @@ -11,7 +11,7 @@ fn main() { let _no_as_str = string.as_bytes(); let _no_as_str = string.is_empty(); - // These methods are not redundant, and are equivelant to + // These methods are not redundant, and are equivalent to // doing dereferencing the string and applying the method let _not_redundant = string.as_str().escape_unicode(); let _not_redundant = string.as_str().trim(); diff --git a/tests/ui/redundant_as_str.rs b/tests/ui/redundant_as_str.rs index 33adb609996..7a74d8a55de 100644 --- a/tests/ui/redundant_as_str.rs +++ b/tests/ui/redundant_as_str.rs @@ -11,7 +11,7 @@ fn main() { let _no_as_str = string.as_bytes(); let _no_as_str = string.is_empty(); - // These methods are not redundant, and are equivelant to + // These methods are not redundant, and are equivalent to // doing dereferencing the string and applying the method let _not_redundant = string.as_str().escape_unicode(); let _not_redundant = string.as_str().trim(); diff --git a/tests/ui/regex.rs b/tests/ui/regex.rs index 1ea0d65bf1e..4fb6c08bb44 100644 --- a/tests/ui/regex.rs +++ b/tests/ui/regex.rs @@ -113,7 +113,7 @@ fn trivial_regex() { // #6005: unicode classes in bytes::Regex let a_byte_of_unicode = BRegex::new(r"\p{C}"); - // start and end word boundry, introduced in regex 0.10 + // start and end word boundary, introduced in regex 0.10 let _ = BRegex::new(r"\"); let _ = BRegex::new(r"\b{start}word\b{end}"); } diff --git a/tests/ui/struct_fields.rs b/tests/ui/struct_fields.rs index 8b1a1446e3c..a8b12c6dfe3 100644 --- a/tests/ui/struct_fields.rs +++ b/tests/ui/struct_fields.rs @@ -65,7 +65,7 @@ struct NotSnakeCase2 { someData_a_b: bool, } -// no error, threshold is 3 fiels by default +// no error, threshold is 3 fields by default struct Fooo { foo: u8, bar: u8, diff --git a/tests/ui/useless_conversion.fixed b/tests/ui/useless_conversion.fixed index ed8387b7eb2..ce00fde2f99 100644 --- a/tests/ui/useless_conversion.fixed +++ b/tests/ui/useless_conversion.fixed @@ -241,7 +241,7 @@ mod issue11300 { foo2::<(), _>([1, 2, 3].into_iter()); // This should lint. Removing the `.into_iter()` means that `I` gets substituted with `[i32; 3]`, - // and `i32: Helper2<[i32, 3]>` is true, so this call is indeed unncessary. + // and `i32: Helper2<[i32, 3]>` is true, so this call is indeed unnecessary. foo3([1, 2, 3]); } @@ -253,7 +253,7 @@ mod issue11300 { S1.foo([1, 2]); - // ICE that occured in itertools + // ICE that occurred in itertools trait Itertools { fn interleave_shortest(self, other: J) where diff --git a/tests/ui/useless_conversion.rs b/tests/ui/useless_conversion.rs index 991a7762fc6..39979619586 100644 --- a/tests/ui/useless_conversion.rs +++ b/tests/ui/useless_conversion.rs @@ -241,7 +241,7 @@ pub fn bar() { foo2::<(), _>([1, 2, 3].into_iter()); // This should lint. Removing the `.into_iter()` means that `I` gets substituted with `[i32; 3]`, - // and `i32: Helper2<[i32, 3]>` is true, so this call is indeed unncessary. + // and `i32: Helper2<[i32, 3]>` is true, so this call is indeed unnecessary. foo3([1, 2, 3].into_iter()); } @@ -253,7 +253,7 @@ pub fn foo(&self, _: I) {} S1.foo([1, 2].into_iter()); - // ICE that occured in itertools + // ICE that occurred in itertools trait Itertools { fn interleave_shortest(self, other: J) where