mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-01 00:49:30 +00:00
Auto merge of #8705 - cpw2n5:spellcheck, r=Manishearth
Spellcheck I'm brand new to this so any feedback will be helpful. I set the project up locally and ran a spellcheck on it. The code changes should only be spelling corrections. I ran the build and tests and they came back successful locally. changelog: Various spelling corrections in comments and code.
This commit is contained in:
commit
9938daf5bc
35 changed files with 64 additions and 64 deletions
2
.github/ISSUE_TEMPLATE/blank_issue.yml
vendored
2
.github/ISSUE_TEMPLATE/blank_issue.yml
vendored
|
@ -9,7 +9,7 @@ body:
|
||||||
attributes:
|
attributes:
|
||||||
label: Description
|
label: Description
|
||||||
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.
|
you feel relevant to replicate it.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
2
.github/ISSUE_TEMPLATE/false_negative.yml
vendored
2
.github/ISSUE_TEMPLATE/false_negative.yml
vendored
|
@ -23,7 +23,7 @@ body:
|
||||||
id: reproducer
|
id: reproducer
|
||||||
attributes:
|
attributes:
|
||||||
label: Reproducer
|
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: |
|
value: |
|
||||||
I tried this code:
|
I tried this code:
|
||||||
|
|
||||||
|
|
2
.github/ISSUE_TEMPLATE/false_positive.yml
vendored
2
.github/ISSUE_TEMPLATE/false_positive.yml
vendored
|
@ -24,7 +24,7 @@ body:
|
||||||
attributes:
|
attributes:
|
||||||
label: Reproducer
|
label: Reproducer
|
||||||
description: >
|
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.
|
output from Clippy.
|
||||||
value: |
|
value: |
|
||||||
I tried this code:
|
I tried this code:
|
||||||
|
|
4
.github/workflows/clippy.yml
vendored
4
.github/workflows/clippy.yml
vendored
|
@ -6,14 +6,14 @@ on:
|
||||||
branches-ignore:
|
branches-ignore:
|
||||||
- auto
|
- auto
|
||||||
- try
|
- try
|
||||||
# Don't run Clippy tests, when only textfiles were modified
|
# Don't run Clippy tests, when only text files were modified
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'COPYRIGHT'
|
- 'COPYRIGHT'
|
||||||
- 'LICENSE-*'
|
- 'LICENSE-*'
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- '**.txt'
|
- '**.txt'
|
||||||
pull_request:
|
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:
|
paths-ignore:
|
||||||
- 'COPYRIGHT'
|
- 'COPYRIGHT'
|
||||||
- 'LICENSE-*'
|
- 'LICENSE-*'
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::path::Path;
|
||||||
const CLIPPY_DEV_DIR: &str = "clippy_dev";
|
const CLIPPY_DEV_DIR: &str = "clippy_dev";
|
||||||
|
|
||||||
/// This function verifies that the tool is being executed in the clippy directory.
|
/// 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.
|
/// 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
|
/// 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() {
|
if path.exists() && path.is_dir() {
|
||||||
true
|
true
|
||||||
} else {
|
} 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
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,7 @@ declare_clippy_lint! {
|
||||||
///
|
///
|
||||||
/// ### Why is this bad?
|
/// ### Why is this bad?
|
||||||
/// Casting a function pointer to an integer can have surprising results and can occur
|
/// 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
|
/// 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
|
/// order to avoid mistakes. Alternatively, you can use this lint to audit all uses of function
|
||||||
/// pointer casts in your code.
|
/// pointer casts in your code.
|
||||||
|
|
|
@ -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
|
// 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 {
|
let Some(braces_span_str) = snippet_opt(cx, braces_span) else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -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);
|
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() {
|
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.
|
// 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 src_is_ref = bound_ty.is_ref() && binding != hir::BindingAnnotation::Ref;
|
||||||
let needs_ref = !(src_is_ref || is_copy(cx, *inner_ty));
|
let needs_ref = !(src_is_ref || is_copy(cx, *inner_ty));
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ declare_clippy_lint! {
|
||||||
/// vec.push(value)
|
/// vec.push(value)
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// if let Some(valie) = iter.next().ok() {
|
/// if let Some(value) = iter.next().ok() {
|
||||||
/// vec.push(value)
|
/// vec.push(value)
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -60,7 +60,7 @@ impl<'tcx> LateLintPass<'tcx> for MatchResultOk {
|
||||||
if_chain! {
|
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 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 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 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";
|
if rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| s.print_path(x, false)) == "Some";
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) {
|
||||||
.map(|a| NormalizedPat::from_pat(cx, &arena, a.pat))
|
.map(|a| NormalizedPat::from_pat(cx, &arena, a.pat))
|
||||||
.collect();
|
.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
|
let forwards_blocking_idxs: Vec<_> = normalized_pats
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
|
@ -43,7 +43,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) {
|
||||||
})
|
})
|
||||||
.collect();
|
.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
|
let backwards_blocking_idxs: Vec<_> = normalized_pats
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
|
|
|
@ -7,7 +7,7 @@ use rustc_semver::RustcVersion;
|
||||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||||
use rustc_span::{Span, SpanData, SyntaxContext};
|
use rustc_span::{Span, SpanData, SyntaxContext};
|
||||||
|
|
||||||
mod infalliable_detructuring_match;
|
mod infallible_destructuring_match;
|
||||||
mod match_as_ref;
|
mod match_as_ref;
|
||||||
mod match_bool;
|
mod match_bool;
|
||||||
mod match_like_matches;
|
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<'_>) {
|
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<'_>) {
|
fn check_pat(&mut self, cx: &LateContext<'tcx>, pat: &'tcx Pat<'_>) {
|
||||||
|
|
|
@ -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
|
/// 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 {
|
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) {
|
if let Some(p_node) = get_parent_node(cx.tcx, p_expr.hir_id) {
|
||||||
match p_node {
|
match p_node {
|
||||||
|
|
|
@ -1266,7 +1266,7 @@ declare_clippy_lint! {
|
||||||
#[clippy::version = "1.55.0"]
|
#[clippy::version = "1.55.0"]
|
||||||
pub EXTEND_WITH_DRAIN,
|
pub EXTEND_WITH_DRAIN,
|
||||||
perf,
|
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! {
|
declare_clippy_lint! {
|
||||||
|
@ -2100,7 +2100,7 @@ declare_clippy_lint! {
|
||||||
/// using `.collect::<String>()` over `.collect::<Vec<String>>().join("")`
|
/// using `.collect::<String>()` over `.collect::<Vec<String>>().join("")`
|
||||||
/// will prevent loop unrolling and will result in a negative performance impact.
|
/// 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>()`
|
/// with aarch64 tending to producing faster assembly in more cases when using `.collect::<String>()`
|
||||||
#[clippy::version = "1.61.0"]
|
#[clippy::version = "1.61.0"]
|
||||||
pub UNNECESSARY_JOIN,
|
pub UNNECESSARY_JOIN,
|
||||||
|
|
|
@ -44,7 +44,7 @@ declare_clippy_lint! {
|
||||||
/// pub struct PubBaz;
|
/// pub struct PubBaz;
|
||||||
/// impl PubBaz {
|
/// impl PubBaz {
|
||||||
/// fn private() {} // ok
|
/// fn private() {} // ok
|
||||||
/// pub fn not_ptrivate() {} // missing #[inline]
|
/// pub fn not_private() {} // missing #[inline]
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// impl Bar for PubBaz {
|
/// impl Bar for PubBaz {
|
||||||
|
|
|
@ -53,7 +53,7 @@ fn is_bitwise_operation(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
|
||||||
false
|
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 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)) {
|
if let (Some(l_snippet), Some(r_snippet)) = (snippet_opt(cx, left.span), snippet_opt(cx, right.span)) {
|
||||||
let op_snippet = match op.node {
|
let op_snippet = match op.node {
|
||||||
|
@ -75,7 +75,7 @@ impl LateLintPass<'_> for NeedlessBitwiseBool {
|
||||||
expr.span,
|
expr.span,
|
||||||
"use of bitwise operator instead of lazy operator between booleans",
|
"use of bitwise operator instead of lazy operator between booleans",
|
||||||
|diag| {
|
|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);
|
diag.span_suggestion(expr.span, "try", sugg, Applicability::MachineApplicable);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -240,7 +240,7 @@ fn check<'tcx>(
|
||||||
cx,
|
cx,
|
||||||
NEEDLESS_LATE_INIT,
|
NEEDLESS_LATE_INIT,
|
||||||
local_stmt.span,
|
local_stmt.span,
|
||||||
"unneeded late initalization",
|
"unneeded late initialization",
|
||||||
|diag| {
|
|diag| {
|
||||||
diag.tool_only_span_suggestion(
|
diag.tool_only_span_suggestion(
|
||||||
local_stmt.span,
|
local_stmt.span,
|
||||||
|
@ -265,7 +265,7 @@ fn check<'tcx>(
|
||||||
cx,
|
cx,
|
||||||
NEEDLESS_LATE_INIT,
|
NEEDLESS_LATE_INIT,
|
||||||
local_stmt.span,
|
local_stmt.span,
|
||||||
"unneeded late initalization",
|
"unneeded late initialization",
|
||||||
|diag| {
|
|diag| {
|
||||||
diag.tool_only_span_suggestion(local_stmt.span, "remove the local", String::new(), applicability);
|
diag.tool_only_span_suggestion(local_stmt.span, "remove the local", String::new(), applicability);
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ fn check<'tcx>(
|
||||||
cx,
|
cx,
|
||||||
NEEDLESS_LATE_INIT,
|
NEEDLESS_LATE_INIT,
|
||||||
local_stmt.span,
|
local_stmt.span,
|
||||||
"unneeded late initalization",
|
"unneeded late initialization",
|
||||||
|diag| {
|
|diag| {
|
||||||
diag.tool_only_span_suggestion(local_stmt.span, "remove the local", String::new(), applicability);
|
diag.tool_only_span_suggestion(local_stmt.span, "remove the local", String::new(), applicability);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ declare_clippy_lint! {
|
||||||
///
|
///
|
||||||
/// ### Known problems
|
/// ### Known problems
|
||||||
/// The actual meaning can be the intended one. `\x00` can be used in these
|
/// 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!()`
|
/// The lint does not trigger for format strings in `print!()`, `write!()`
|
||||||
/// and friends since the string is already preprocessed when Clippy lints
|
/// and friends since the string is already preprocessed when Clippy lints
|
||||||
|
|
|
@ -78,7 +78,7 @@ fn is_result_ok(cx: &LateContext<'_>, expr: &'_ Expr<'_>) -> bool {
|
||||||
|
|
||||||
/// A struct containing information about occurrences of the
|
/// A struct containing information about occurrences of the
|
||||||
/// `if let Some(..) = .. else` construct that this lint detects.
|
/// `if let Some(..) = .. else` construct that this lint detects.
|
||||||
struct OptionIfLetElseOccurence {
|
struct OptionIfLetElseOccurrence {
|
||||||
option: String,
|
option: String,
|
||||||
method_sugg: String,
|
method_sugg: String,
|
||||||
some_expr: 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
|
/// 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.
|
/// 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_chain! {
|
||||||
if !expr.span.from_expansion(); // Don't lint macros, because it behaves weirdly
|
if !expr.span.from_expansion(); // Don't lint macros, because it behaves weirdly
|
||||||
if !in_constant(cx, expr.hir_id);
|
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),
|
option: format_option_in_sugg(cx, cond_expr, as_ref, as_mut),
|
||||||
method_sugg: method_sugg.to_string(),
|
method_sugg: method_sugg.to_string(),
|
||||||
some_expr: format!("|{}{}| {}", capture_mut, capture_name, Sugg::hir_with_macro_callsite(cx, some_body, "..")),
|
some_expr: format!("|{}{}| {}", capture_mut, capture_name, Sugg::hir_with_macro_callsite(cx, some_body, "..")),
|
||||||
|
|
|
@ -550,7 +550,7 @@ fn ident_difference_expr_with_base_location(
|
||||||
// IdentIter, then the output of this function will be almost always be correct
|
// IdentIter, then the output of this function will be almost always be correct
|
||||||
// in practice.
|
// 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,
|
// then we should be able to change this function to do the correct traversal,
|
||||||
// without needing to change the rest of the code.
|
// without needing to change the rest of the code.
|
||||||
|
|
||||||
|
|
|
@ -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);
|
let res = check.do_check(&fn_ctxt);
|
||||||
|
|
||||||
// do_check's documentation says that it might return Ok and create
|
// 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.
|
// should be filtered out before getting here.
|
||||||
assert!(
|
assert!(
|
||||||
!fn_ctxt.errors_reported_since_creation(),
|
!fn_ctxt.errors_reported_since_creation(),
|
||||||
|
|
|
@ -432,8 +432,8 @@ impl Types {
|
||||||
fn check_fn_decl(&mut self, cx: &LateContext<'_>, decl: &FnDecl<'_>, context: CheckTyContext) {
|
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.
|
// 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
|
||||||
// check.
|
// to check.
|
||||||
if context.is_in_trait_impl {
|
if context.is_in_trait_impl {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ declare_clippy_lint! {
|
||||||
/// *disjunctive normal form (DNF)* into *conjunctive normal form (CNF)*.
|
/// *disjunctive normal form (DNF)* into *conjunctive normal form (CNF)*.
|
||||||
///
|
///
|
||||||
/// ### Why is this bad?
|
/// ### 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
|
/// ### Example
|
||||||
/// ```rust
|
/// ```rust
|
||||||
|
|
|
@ -30,7 +30,7 @@ declare_clippy_lint! {
|
||||||
///
|
///
|
||||||
/// ### Known problems
|
/// ### Known problems
|
||||||
/// - Unaddressed false negative in fn bodies of trait implementations
|
/// - 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
|
/// ### Example
|
||||||
/// ```rust
|
/// ```rust
|
||||||
|
|
|
@ -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
|
/// 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.
|
/// is set to the name of the variable passed to the macro.
|
||||||
macro_rules! opt_bind {
|
macro_rules! opt_bind {
|
||||||
|
|
|
@ -292,7 +292,7 @@ declare_clippy_lint! {
|
||||||
/// Checks for unnecessary conversion from Symbol to a string.
|
/// Checks for unnecessary conversion from Symbol to a string.
|
||||||
///
|
///
|
||||||
/// ### Why is this bad?
|
/// ### Why is this bad?
|
||||||
/// It's faster use symbols directly intead of strings.
|
/// It's faster use symbols directly instead of strings.
|
||||||
///
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
/// Bad:
|
/// Bad:
|
||||||
|
@ -823,7 +823,7 @@ fn suggest_note(
|
||||||
cx,
|
cx,
|
||||||
COLLAPSIBLE_SPAN_LINT_CALLS,
|
COLLAPSIBLE_SPAN_LINT_CALLS,
|
||||||
expr.span,
|
expr.span,
|
||||||
"this call is collspible",
|
"this call is collapsible",
|
||||||
"collapse into",
|
"collapse into",
|
||||||
format!(
|
format!(
|
||||||
"span_lint_and_note({}, {}, {}, {}, {}, {})",
|
"span_lint_and_note({}, {}, {}, {}, {}, {})",
|
||||||
|
|
|
@ -117,7 +117,7 @@ const APPLICABILITY_NAME_INDEX: usize = 2;
|
||||||
/// This applicability will be set for unresolved applicability values.
|
/// This applicability will be set for unresolved applicability values.
|
||||||
const APPLICABILITY_UNRESOLVED_STR: &str = "Unresolved";
|
const APPLICABILITY_UNRESOLVED_STR: &str = "Unresolved";
|
||||||
/// The version that will be displayed if none has been defined
|
/// 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! {
|
declare_clippy_lint! {
|
||||||
/// ### What it does
|
/// ### 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 {
|
fn get_lint_version(cx: &LateContext<'_>, item: &Item<'_>) -> String {
|
||||||
extract_clippy_version_value(cx, item).map_or_else(
|
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(),
|
|version| version.as_str().to_string(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -872,7 +872,7 @@ impl<'a, 'hir> IsMultiSpanScanner<'a, 'hir> {
|
||||||
self.suggestion_count += 2;
|
self.suggestion_count += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if the suggestions include multiple spanns
|
/// Checks if the suggestions include multiple spans
|
||||||
fn is_multi_part(&self) -> bool {
|
fn is_multi_part(&self) -> bool {
|
||||||
self.suggestion_count > 1
|
self.suggestion_count > 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,7 +367,7 @@ impl<'tcx> FormatArgsExpn<'tcx> {
|
||||||
expr_visitor_no_bodies(|e| {
|
expr_visitor_no_bodies(|e| {
|
||||||
// if we're still inside of the macro definition...
|
// if we're still inside of the macro definition...
|
||||||
if e.span.ctxt() == expr.span.ctxt() {
|
if e.span.ctxt() == expr.span.ctxt() {
|
||||||
// ArgumnetV1::new_<format_trait>(<value>)
|
// ArgumentV1::new_<format_trait>(<value>)
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let ExprKind::Call(callee, [val]) = e.kind;
|
if let ExprKind::Call(callee, [val]) = e.kind;
|
||||||
if let ExprKind::Path(QPath::TypeRelative(ty, seg)) = callee.kind;
|
if let ExprKind::Path(QPath::TypeRelative(ty, seg)) = callee.kind;
|
||||||
|
|
|
@ -108,7 +108,7 @@ pub fn is_present_in_source<T: LintContext>(cx: &T, span: Span) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the positon just before rarrow
|
/// Returns the position just before rarrow
|
||||||
///
|
///
|
||||||
/// ```rust,ignore
|
/// ```rust,ignore
|
||||||
/// fn into(self) -> () {}
|
/// fn into(self) -> () {}
|
||||||
|
|
|
@ -393,7 +393,7 @@ struct LintcheckConfig {
|
||||||
lintcheck_results_path: PathBuf,
|
lintcheck_results_path: PathBuf,
|
||||||
/// whether to just run --fix and not collect all the warnings
|
/// whether to just run --fix and not collect all the warnings
|
||||||
fix: bool,
|
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>,
|
lint_filter: Vec<String>,
|
||||||
/// Indicate if the output should support markdown syntax
|
/// Indicate if the output should support markdown syntax
|
||||||
markdown: bool,
|
markdown: bool,
|
||||||
|
|
|
@ -66,7 +66,7 @@ fn lint_message_convention() {
|
||||||
|
|
||||||
// make sure that lint messages:
|
// make sure that lint messages:
|
||||||
// * are not capitalized
|
// * 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
|
// these directories have interesting tests
|
||||||
let test_dirs = ["ui", "ui-cargo", "ui-internal", "ui-toml"]
|
let test_dirs = ["ui", "ui-cargo", "ui-internal", "ui-toml"]
|
||||||
|
|
|
@ -29,7 +29,7 @@ LL | | db.help(help_msg);
|
||||||
LL | | });
|
LL | | });
|
||||||
| |__________^ help: collapse into: `span_lint_and_help(cx, TEST_LINT, expr.span, lint_msg, None, help_msg)`
|
| |__________^ help: collapse into: `span_lint_and_help(cx, TEST_LINT, expr.span, lint_msg, None, help_msg)`
|
||||||
|
|
||||||
error: this call is collspible
|
error: this call is collapsible
|
||||||
--> $DIR/collapsible_span_lint_calls.rs:45:9
|
--> $DIR/collapsible_span_lint_calls.rs:45:9
|
||||||
|
|
|
|
||||||
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
|
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
|
||||||
|
@ -37,7 +37,7 @@ LL | | db.span_note(expr.span, note_msg);
|
||||||
LL | | });
|
LL | | });
|
||||||
| |__________^ help: collapse into: `span_lint_and_note(cx, TEST_LINT, expr.span, lint_msg, Some(expr.span), note_msg)`
|
| |__________^ help: collapse into: `span_lint_and_note(cx, TEST_LINT, expr.span, lint_msg, Some(expr.span), note_msg)`
|
||||||
|
|
||||||
error: this call is collspible
|
error: this call is collapsible
|
||||||
--> $DIR/collapsible_span_lint_calls.rs:48:9
|
--> $DIR/collapsible_span_lint_calls.rs:48:9
|
||||||
|
|
|
|
||||||
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
|
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
|
||||||
|
|
|
@ -13,7 +13,7 @@ use proc_macro::{quote, TokenStream};
|
||||||
|
|
||||||
#[proc_macro_derive(DeriveSomething)]
|
#[proc_macro_derive(DeriveSomething)]
|
||||||
pub fn derive(_: TokenStream) -> TokenStream {
|
pub fn derive(_: TokenStream) -> TokenStream {
|
||||||
// Shound not trigger `used_underscore_binding`
|
// Should not trigger `used_underscore_binding`
|
||||||
let _inside_derive = 1;
|
let _inside_derive = 1;
|
||||||
assert_eq!(_inside_derive, _inside_derive);
|
assert_eq!(_inside_derive, _inside_derive);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init.rs:5:5
|
--> $DIR/needless_late_init.rs:5:5
|
||||||
|
|
|
|
||||||
LL | let a;
|
LL | let a;
|
||||||
|
@ -20,7 +20,7 @@ help: add a semicolon after the `match` expression
|
||||||
LL | };
|
LL | };
|
||||||
| +
|
| +
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init.rs:14:5
|
--> $DIR/needless_late_init.rs:14:5
|
||||||
|
|
|
|
||||||
LL | let b;
|
LL | let b;
|
||||||
|
@ -41,7 +41,7 @@ help: add a semicolon after the `if` expression
|
||||||
LL | };
|
LL | };
|
||||||
| +
|
| +
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init.rs:21:5
|
--> $DIR/needless_late_init.rs:21:5
|
||||||
|
|
|
|
||||||
LL | let c;
|
LL | let c;
|
||||||
|
@ -62,7 +62,7 @@ help: add a semicolon after the `if` expression
|
||||||
LL | };
|
LL | };
|
||||||
| +
|
| +
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init.rs:28:5
|
--> $DIR/needless_late_init.rs:28:5
|
||||||
|
|
|
|
||||||
LL | let d;
|
LL | let d;
|
||||||
|
@ -83,7 +83,7 @@ help: add a semicolon after the `if` expression
|
||||||
LL | };
|
LL | };
|
||||||
| +
|
| +
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init.rs:36:5
|
--> $DIR/needless_late_init.rs:36:5
|
||||||
|
|
|
|
||||||
LL | let e;
|
LL | let e;
|
||||||
|
@ -104,7 +104,7 @@ help: add a semicolon after the `if` expression
|
||||||
LL | };
|
LL | };
|
||||||
| +
|
| +
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init.rs:43:5
|
--> $DIR/needless_late_init.rs:43:5
|
||||||
|
|
|
|
||||||
LL | let f;
|
LL | let f;
|
||||||
|
@ -120,7 +120,7 @@ LL - 1 => f = "three",
|
||||||
LL + 1 => "three",
|
LL + 1 => "three",
|
||||||
|
|
|
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init.rs:49:5
|
--> $DIR/needless_late_init.rs:49:5
|
||||||
|
|
|
|
||||||
LL | let g: usize;
|
LL | let g: usize;
|
||||||
|
@ -140,7 +140,7 @@ help: add a semicolon after the `if` expression
|
||||||
LL | };
|
LL | };
|
||||||
| +
|
| +
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init.rs:64:5
|
--> $DIR/needless_late_init.rs:64:5
|
||||||
|
|
|
|
||||||
LL | let a;
|
LL | let a;
|
||||||
|
@ -161,7 +161,7 @@ help: add a semicolon after the `match` expression
|
||||||
LL | };
|
LL | };
|
||||||
| +
|
| +
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init.rs:81:5
|
--> $DIR/needless_late_init.rs:81:5
|
||||||
|
|
|
|
||||||
LL | let a;
|
LL | let a;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init_fixable.rs:6:5
|
--> $DIR/needless_late_init_fixable.rs:6:5
|
||||||
|
|
|
|
||||||
LL | let a;
|
LL | let a;
|
||||||
|
@ -10,7 +10,7 @@ help: declare `a` here
|
||||||
LL | let a = "zero";
|
LL | let a = "zero";
|
||||||
| ~~~~~
|
| ~~~~~
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init_fixable.rs:9:5
|
--> $DIR/needless_late_init_fixable.rs:9:5
|
||||||
|
|
|
|
||||||
LL | let b;
|
LL | let b;
|
||||||
|
@ -21,7 +21,7 @@ help: declare `b` here
|
||||||
LL | let b = 1;
|
LL | let b = 1;
|
||||||
| ~~~~~
|
| ~~~~~
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init_fixable.rs:10:5
|
--> $DIR/needless_late_init_fixable.rs:10:5
|
||||||
|
|
|
|
||||||
LL | let c;
|
LL | let c;
|
||||||
|
@ -32,7 +32,7 @@ help: declare `c` here
|
||||||
LL | let c = 2;
|
LL | let c = 2;
|
||||||
| ~~~~~
|
| ~~~~~
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init_fixable.rs:14:5
|
--> $DIR/needless_late_init_fixable.rs:14:5
|
||||||
|
|
|
|
||||||
LL | let d: usize;
|
LL | let d: usize;
|
||||||
|
@ -43,7 +43,7 @@ help: declare `d` here
|
||||||
LL | let d: usize = 1;
|
LL | let d: usize = 1;
|
||||||
| ~~~~~~~~~~~~
|
| ~~~~~~~~~~~~
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init_fixable.rs:17:5
|
--> $DIR/needless_late_init_fixable.rs:17:5
|
||||||
|
|
|
|
||||||
LL | let mut e;
|
LL | let mut e;
|
||||||
|
@ -54,7 +54,7 @@ help: declare `e` here
|
||||||
LL | let mut e = 1;
|
LL | let mut e = 1;
|
||||||
| ~~~~~~~~~
|
| ~~~~~~~~~
|
||||||
|
|
||||||
error: unneeded late initalization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init_fixable.rs:21:5
|
--> $DIR/needless_late_init_fixable.rs:21:5
|
||||||
|
|
|
|
||||||
LL | let h;
|
LL | let h;
|
||||||
|
|
Loading…
Reference in a new issue