adding spell checking

This commit is contained in:
whodi 2022-04-15 14:25:55 -04:00 committed by Manish Goregaokar
parent c0fce5a847
commit 29ef80c78a
31 changed files with 46 additions and 46 deletions

View file

@ -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

View file

@ -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:

View file

@ -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:

View file

@ -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-*'

View file

@ -18,7 +18,7 @@ pub fn install_hook(force_override: bool) {
// So a little bit of a funny story. Git on unix requires the pre-commit file
// to have the `execute` permission to be set. The Rust functions for modifying
// these flags doesn't seem to work when executed with normal user permissions.
// these flags doesn't seem to work when executed with normal user permissions.
//
// However, there is a little hack that is also being used by Rust itself in their
// setup script. Git saves the `execute` flag when syncing files. This means

View file

@ -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
@ -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
}
}

View file

@ -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.

View file

@ -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;

View file

@ -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));

View file

@ -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)
/// }
/// ```
@ -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";

View file

@ -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()
@ -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()

View file

@ -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;
@ -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<'_>) {

View file

@ -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 {

View file

@ -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! {
@ -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,

View file

@ -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 {

View file

@ -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 {
@ -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);
}
},

View file

@ -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,
@ -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);
@ -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);

View file

@ -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

View file

@ -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,
@ -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);
@ -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, "..")),

View file

@ -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.

View file

@ -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(),

View file

@ -432,7 +432,7 @@ 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
// 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;

View file

@ -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

View file

@ -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

View file

@ -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 {

View file

@ -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:
@ -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({}, {}, {}, {}, {}, {})",

View file

@ -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
@ -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(),
)
}
@ -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
}

View file

@ -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;

View file

@ -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) -> () {}

View file

@ -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"]

View file

@ -13,7 +13,7 @@ use proc_macro::{quote, TokenStream};
#[proc_macro_derive(DeriveSomething)]
pub fn derive(_: TokenStream) -> TokenStream {
// Shound not trigger `used_underscore_binding`
// Should not trigger `used_underscore_binding`
let _inside_derive = 1;
assert_eq!(_inside_derive, _inside_derive);