Skip to content

Fix some typos #12079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion book/src/development/macro_expansions.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ let x: Option<u32> = 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)
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3786,7 +3786,7 @@ declare_clippy_lint! {
///
/// ### 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
Expand All @@ -3812,7 +3812,7 @@ declare_clippy_lint! {
///
/// ### 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
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/missing_asserts_for_indexing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ fn report_indexes(cx: &LateContext<'_>, map: &UnhashMap<u64, Vec<IndexEntry<'_>>
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`
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/no_effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/serde_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rustc_session::declare_lint_pass;

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
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/wildcard_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl LateLintPass<'_> for WildcardImports {
} 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());
Expand Down
6 changes: 3 additions & 3 deletions clippy_utils/src/ty/type_certainty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))),
)
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/as_conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn main() {
with_span!(
span

fn coverting() {
fn converting() {
let x = 0u32 as u64;
}
);
2 changes: 1 addition & 1 deletion tests/ui/default_numeric_fallback_i32.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/default_numeric_fallback_i32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/redundant_as_str.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/redundant_as_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"\<word\>");
let _ = BRegex::new(r"\b{start}word\b{end}");
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/struct_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/useless_conversion.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

Expand All @@ -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<J>(self, other: J)
where
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/useless_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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].into_iter());
}

Expand All @@ -253,7 +253,7 @@ mod issue11300 {

S1.foo([1, 2].into_iter());

// ICE that occured in itertools
// ICE that occurred in itertools
trait Itertools {
fn interleave_shortest<J>(self, other: J)
where
Expand Down