Skip to content

Spellcheck #8705

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 5 commits into from
Apr 15, 2022
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 .github/ISSUE_TEMPLATE/blank_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body:
attributes:
label: Description
description: >
Please provide a discription of the issue, along with any information
Please provide a description of the issue, along with any information
you feel relevant to replicate it.
validations:
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/false_negative.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ body:
id: reproducer
attributes:
label: Reproducer
description: Please provide the code and steps to repoduce the bug
description: Please provide the code and steps to reproduce the bug
value: |
I tried this code:

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/false_positive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ body:
attributes:
label: Reproducer
description: >
Please provide the code and steps to repoduce the bug together with the
Please provide the code and steps to reproduce the bug together with the
output from Clippy.
value: |
I tried this code:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ on:
branches-ignore:
- auto
- try
# Don't run Clippy tests, when only textfiles were modified
# Don't run Clippy tests, when only text files were modified
paths-ignore:
- 'COPYRIGHT'
- 'LICENSE-*'
- '**.md'
- '**.txt'
pull_request:
# Don't run Clippy tests, when only textfiles were modified
# Don't run Clippy tests, when only text files were modified
paths-ignore:
- 'COPYRIGHT'
- 'LICENSE-*'
Expand Down
4 changes: 2 additions & 2 deletions clippy_dev/src/setup/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::path::Path;
const CLIPPY_DEV_DIR: &str = "clippy_dev";

/// This function verifies that the tool is being executed in the clippy directory.
/// This is useful to ensure that setups only modify Clippys resources. The verification
/// This is useful to ensure that setups only modify Clippy's resources. The verification
/// is done by checking that `clippy_dev` is a sub directory of the current directory.
///
/// It will print an error message and return `false` if the directory could not be
Expand All @@ -17,7 +17,7 @@ fn verify_inside_clippy_dir() -> bool {
if path.exists() && path.is_dir() {
true
} else {
eprintln!("error: unable to verify that the working directory is clippys directory");
eprintln!("error: unable to verify that the working directory is clippy's directory");
false
}
}
2 changes: 1 addition & 1 deletion clippy_lints/src/casts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ declare_clippy_lint! {
///
/// ### Why is this bad?
/// Casting a function pointer to an integer can have surprising results and can occur
/// accidentally if parantheses are omitted from a function call. If you aren't doing anything
/// accidentally if parentheses are omitted from a function call. If you aren't doing anything
/// low-level with function pointers then you can opt-out of casting functions to integers in
/// order to avoid mistakes. Alternatively, you can use this lint to audit all uses of function
/// pointer casts in your code.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/empty_structs_with_brackets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn has_no_fields(cx: &EarlyContext<'_>, var_data: &VariantData, braces_span: Spa
}

// there might still be field declarations hidden from the AST
// (conditionaly compiled code using #[cfg(..)])
// (conditionally compiled code using #[cfg(..)])

let Some(braces_span_str) = snippet_opt(cx, braces_span) else {
return false;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/index_refutable_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ fn find_slice_values(cx: &LateContext<'_>, pat: &hir::Pat<'_>) -> FxIndexMap<hir
let bound_ty = cx.typeck_results().node_type(pat.hir_id);
if let ty::Slice(inner_ty) | ty::Array(inner_ty, _) = bound_ty.peel_refs().kind() {
// The values need to use the `ref` keyword if they can't be copied.
// This will need to be adjusted if the lint want to support multable access in the future
// This will need to be adjusted if the lint want to support mutable access in the future
let src_is_ref = bound_ty.is_ref() && binding != hir::BindingAnnotation::Ref;
let needs_ref = !(src_is_ref || is_copy(cx, *inner_ty));

Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/match_result_ok.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ declare_clippy_lint! {
/// vec.push(value)
/// }
///
/// if let Some(valie) = iter.next().ok() {
/// if let Some(value) = iter.next().ok() {
/// vec.push(value)
/// }
/// ```
Expand Down Expand Up @@ -60,7 +60,7 @@ impl<'tcx> LateLintPass<'tcx> for MatchResultOk {
if_chain! {
if let ExprKind::MethodCall(ok_path, [ref result_types_0, ..], _) = let_expr.kind; //check is expr.ok() has type Result<T,E>.ok(, _)
if let PatKind::TupleStruct(QPath::Resolved(_, x), y, _) = let_pat.kind; //get operation
if method_chain_args(let_expr, &["ok"]).is_some(); //test to see if using ok() methoduse std::marker::Sized;
if method_chain_args(let_expr, &["ok"]).is_some(); //test to see if using ok() method use std::marker::Sized;
if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(result_types_0), sym::Result);
if rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| s.print_path(x, false)) == "Some";

Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/matches/match_same_arms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) {
.map(|a| NormalizedPat::from_pat(cx, &arena, a.pat))
.collect();

// The furthast forwards a pattern can move without semantic changes
// The furthest forwards a pattern can move without semantic changes
let forwards_blocking_idxs: Vec<_> = normalized_pats
.iter()
.enumerate()
Expand All @@ -43,7 +43,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) {
})
.collect();

// The furthast backwards a pattern can move without semantic changes
// The furthest backwards a pattern can move without semantic changes
let backwards_blocking_idxs: Vec<_> = normalized_pats
.iter()
.enumerate()
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_semver::RustcVersion;
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::{Span, SpanData, SyntaxContext};

mod infalliable_detructuring_match;
mod infallible_destructuring_match;
mod match_as_ref;
mod match_bool;
mod match_like_matches;
Expand Down Expand Up @@ -694,7 +694,7 @@ impl<'tcx> LateLintPass<'tcx> for Matches {
}

fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx Local<'_>) {
self.infallible_destructuring_match_linted |= infalliable_detructuring_match::check(cx, local);
self.infallible_destructuring_match_linted |= infallible_destructuring_match::check(cx, local);
}

fn check_pat(&mut self, cx: &LateContext<'tcx>, pat: &'tcx Pat<'_>) {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/matches/needless_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ fn strip_return<'hir>(expr: &'hir Expr<'hir>) -> &'hir Expr<'hir> {
}

/// Manually check for coercion casting by checking if the type of the match operand or let expr
/// differs with the assigned local variable or the funtion return type.
/// differs with the assigned local variable or the function return type.
fn expr_ty_matches_p_ty(cx: &LateContext<'_>, expr: &Expr<'_>, p_expr: &Expr<'_>) -> bool {
if let Some(p_node) = get_parent_node(cx.tcx, p_expr.hir_id) {
match p_node {
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 @@ -1266,7 +1266,7 @@ declare_clippy_lint! {
#[clippy::version = "1.55.0"]
pub EXTEND_WITH_DRAIN,
perf,
"using vec.append(&mut vec) to move the full range of a vecor to another"
"using vec.append(&mut vec) to move the full range of a vector to another"
}

declare_clippy_lint! {
Expand Down Expand Up @@ -2100,7 +2100,7 @@ declare_clippy_lint! {
/// using `.collect::<String>()` over `.collect::<Vec<String>>().join("")`
/// will prevent loop unrolling and will result in a negative performance impact.
///
/// Additionlly, differences have been observed between aarch64 and x86_64 assembly output,
/// Additionally, differences have been observed between aarch64 and x86_64 assembly output,
/// with aarch64 tending to producing faster assembly in more cases when using `.collect::<String>()`
#[clippy::version = "1.61.0"]
pub UNNECESSARY_JOIN,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/missing_inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ declare_clippy_lint! {
/// pub struct PubBaz;
/// impl PubBaz {
/// fn private() {} // ok
/// pub fn not_ptrivate() {} // missing #[inline]
/// pub fn not_private() {} // missing #[inline]
/// }
///
/// impl Bar for PubBaz {
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/needless_bitwise_bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn is_bitwise_operation(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
false
}

fn suggession_snippet(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<String> {
fn suggesstion_snippet(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<String> {
if let ExprKind::Binary(ref op, left, right) = expr.kind {
if let (Some(l_snippet), Some(r_snippet)) = (snippet_opt(cx, left.span), snippet_opt(cx, right.span)) {
let op_snippet = match op.node {
Expand All @@ -75,7 +75,7 @@ impl LateLintPass<'_> for NeedlessBitwiseBool {
expr.span,
"use of bitwise operator instead of lazy operator between booleans",
|diag| {
if let Some(sugg) = suggession_snippet(cx, expr) {
if let Some(sugg) = suggesstion_snippet(cx, expr) {
diag.span_suggestion(expr.span, "try", sugg, Applicability::MachineApplicable);
}
},
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/needless_late_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ fn check<'tcx>(
cx,
NEEDLESS_LATE_INIT,
local_stmt.span,
"unneeded late initalization",
"unneeded late initialization",
|diag| {
diag.tool_only_span_suggestion(
local_stmt.span,
Expand All @@ -265,7 +265,7 @@ fn check<'tcx>(
cx,
NEEDLESS_LATE_INIT,
local_stmt.span,
"unneeded late initalization",
"unneeded late initialization",
|diag| {
diag.tool_only_span_suggestion(local_stmt.span, "remove the local", String::new(), applicability);

Expand Down Expand Up @@ -296,7 +296,7 @@ fn check<'tcx>(
cx,
NEEDLESS_LATE_INIT,
local_stmt.span,
"unneeded late initalization",
"unneeded late initialization",
|diag| {
diag.tool_only_span_suggestion(local_stmt.span, "remove the local", String::new(), applicability);

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/octal_escapes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ declare_clippy_lint! {
///
/// ### Known problems
/// The actual meaning can be the intended one. `\x00` can be used in these
/// cases to be unambigious.
/// cases to be unambiguous.
///
/// The lint does not trigger for format strings in `print!()`, `write!()`
/// and friends since the string is already preprocessed when Clippy lints
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/option_if_let_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn is_result_ok(cx: &LateContext<'_>, expr: &'_ Expr<'_>) -> bool {

/// A struct containing information about occurrences of the
/// `if let Some(..) = .. else` construct that this lint detects.
struct OptionIfLetElseOccurence {
struct OptionIfLetElseOccurrence {
option: String,
method_sugg: String,
some_expr: String,
Expand All @@ -100,9 +100,9 @@ fn format_option_in_sugg(cx: &LateContext<'_>, cond_expr: &Expr<'_>, as_ref: boo
}

/// If this expression is the option if let/else construct we're detecting, then
/// this function returns an `OptionIfLetElseOccurence` struct with details if
/// this function returns an `OptionIfLetElseOccurrence` struct with details if
/// this construct is found, or None if this construct is not found.
fn detect_option_if_let_else<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) -> Option<OptionIfLetElseOccurence> {
fn detect_option_if_let_else<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) -> Option<OptionIfLetElseOccurrence> {
if_chain! {
if !expr.span.from_expansion(); // Don't lint macros, because it behaves weirdly
if !in_constant(cx, expr.hir_id);
Expand Down Expand Up @@ -154,7 +154,7 @@ fn detect_option_if_let_else<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) ->
}
}
}
Some(OptionIfLetElseOccurence {
Some(OptionIfLetElseOccurrence {
option: format_option_in_sugg(cx, cond_expr, as_ref, as_mut),
method_sugg: method_sugg.to_string(),
some_expr: format!("|{}{}| {}", capture_mut, capture_name, Sugg::hir_with_macro_callsite(cx, some_body, "..")),
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/suspicious_operation_groupings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ fn ident_difference_expr_with_base_location(
// IdentIter, then the output of this function will be almost always be correct
// in practice.
//
// If it turns out that problematic cases are more prelavent than we assume,
// If it turns out that problematic cases are more prevalent than we assume,
// then we should be able to change this function to do the correct traversal,
// without needing to change the rest of the code.

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/transmute/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn check_cast<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, from_ty: Ty<'tcx>
let res = check.do_check(&fn_ctxt);

// do_check's documentation says that it might return Ok and create
// errors in the fcx instead of returing Err in some cases. Those cases
// errors in the fcx instead of returning Err in some cases. Those cases
// should be filtered out before getting here.
assert!(
!fn_ctxt.errors_reported_since_creation(),
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ impl Types {
fn check_fn_decl(&mut self, cx: &LateContext<'_>, decl: &FnDecl<'_>, context: CheckTyContext) {
// Ignore functions in trait implementations as they are usually forced by the trait definition.
//
// FIXME: idially we would like to warn *if the compicated type can be simplified*, but it's hard to
// check.
// FIXME: ideally we would like to warn *if the complicated type can be simplified*, but it's hard
// to check.
if context.is_in_trait_impl {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/unnested_or_patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ declare_clippy_lint! {
/// *disjunctive normal form (DNF)* into *conjunctive normal form (CNF)*.
///
/// ### Why is this bad?
/// In the example above, `Some` is repeated, which unncessarily complicates the pattern.
/// In the example above, `Some` is repeated, which unnecessarily complicates the pattern.
///
/// ### Example
/// ```rust
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/use_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ declare_clippy_lint! {
///
/// ### Known problems
/// - Unaddressed false negative in fn bodies of trait implementations
/// - False positive with assotiated types in traits (#4140)
/// - False positive with associated types in traits (#4140)
///
/// ### Example
/// ```rust
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ macro_rules! bind {
};
}

/// Transforms the given `Option<T>` varibles into `OptionPat<Binding<T>>`.
/// Transforms the given `Option<T>` variables into `OptionPat<Binding<T>>`.
/// This displays as `Some($name)` or `None` when printed. The name of the inner binding
/// is set to the name of the variable passed to the macro.
macro_rules! opt_bind {
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/utils/internal_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ declare_clippy_lint! {
/// Checks for unnecessary conversion from Symbol to a string.
///
/// ### Why is this bad?
/// It's faster use symbols directly intead of strings.
/// It's faster use symbols directly instead of strings.
///
/// ### Example
/// Bad:
Expand Down Expand Up @@ -823,7 +823,7 @@ fn suggest_note(
cx,
COLLAPSIBLE_SPAN_LINT_CALLS,
expr.span,
"this call is collspible",
"this call is collapsible",
"collapse into",
format!(
"span_lint_and_note({}, {}, {}, {}, {}, {})",
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/utils/internal_lints/metadata_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const APPLICABILITY_NAME_INDEX: usize = 2;
/// This applicability will be set for unresolved applicability values.
const APPLICABILITY_UNRESOLVED_STR: &str = "Unresolved";
/// The version that will be displayed if none has been defined
const VERION_DEFAULT_STR: &str = "Unknown";
const VERSION_DEFAULT_STR: &str = "Unknown";

declare_clippy_lint! {
/// ### What it does
Expand Down Expand Up @@ -571,7 +571,7 @@ fn extract_attr_docs(cx: &LateContext<'_>, item: &Item<'_>) -> Option<String> {

fn get_lint_version(cx: &LateContext<'_>, item: &Item<'_>) -> String {
extract_clippy_version_value(cx, item).map_or_else(
|| VERION_DEFAULT_STR.to_string(),
|| VERSION_DEFAULT_STR.to_string(),
|version| version.as_str().to_string(),
)
}
Expand Down Expand Up @@ -872,7 +872,7 @@ impl<'a, 'hir> IsMultiSpanScanner<'a, 'hir> {
self.suggestion_count += 2;
}

/// Checks if the suggestions include multiple spanns
/// Checks if the suggestions include multiple spans
fn is_multi_part(&self) -> bool {
self.suggestion_count > 1
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ impl<'tcx> FormatArgsExpn<'tcx> {
expr_visitor_no_bodies(|e| {
// if we're still inside of the macro definition...
if e.span.ctxt() == expr.span.ctxt() {
// ArgumnetV1::new_<format_trait>(<value>)
// ArgumentV1::new_<format_trait>(<value>)
if_chain! {
if let ExprKind::Call(callee, [val]) = e.kind;
if let ExprKind::Path(QPath::TypeRelative(ty, seg)) = callee.kind;
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub fn is_present_in_source<T: LintContext>(cx: &T, span: Span) -> bool {
true
}

/// Returns the positon just before rarrow
/// Returns the position just before rarrow
///
/// ```rust,ignore
/// fn into(self) -> () {}
Expand Down
2 changes: 1 addition & 1 deletion lintcheck/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ struct LintcheckConfig {
lintcheck_results_path: PathBuf,
/// whether to just run --fix and not collect all the warnings
fix: bool,
/// A list of lint that this lintcheck run shound focus on
/// A list of lints that this lintcheck run should focus on
lint_filter: Vec<String>,
/// Indicate if the output should support markdown syntax
markdown: bool,
Expand Down
2 changes: 1 addition & 1 deletion tests/lint_message_convention.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn lint_message_convention() {

// make sure that lint messages:
// * are not capitalized
// * don't have puncuation at the end of the last sentence
// * don't have punctuation at the end of the last sentence

// these directories have interesting tests
let test_dirs = ["ui", "ui-cargo", "ui-internal", "ui-toml"]
Expand Down
Loading