Skip to content

Commit 84ab59c

Browse files
committed
replace lints and lint with check
1 parent 752febf commit 84ab59c

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

clippy_lints/src/methods/bind_instead_of_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub(crate) trait BindInsteadOfMap {
158158
}
159159

160160
/// Lint use of `_.and_then(|x| Some(y))` for `Option`s
161-
fn lint(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[hir::Expr<'_>]) -> bool {
161+
fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[hir::Expr<'_>]) -> bool {
162162
if !match_type(cx, cx.typeck_results().expr_ty(&args[0]), Self::TYPE_QPATH) {
163163
return false;
164164
}

clippy_lints/src/methods/bytes_nth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_span::sym;
77

88
use super::BYTES_NTH;
99

10-
pub(super) fn lints<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, iter_args: &'tcx [Expr<'tcx>]) {
10+
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, iter_args: &'tcx [Expr<'tcx>]) {
1111
if_chain! {
1212
if let ExprKind::MethodCall(_, _, ref args, _) = expr.kind;
1313
let ty = cx.typeck_results().expr_ty(&iter_args[0]).peel_refs();

clippy_lints/src/methods/inefficient_to_string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_middle::ty::{self, Ty};
1010
use rustc_span::sym;
1111

1212
/// Checks for the `INEFFICIENT_TO_STRING` lint
13-
pub fn lint<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, arg: &hir::Expr<'_>, arg_ty: Ty<'tcx>) {
13+
pub fn check<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, arg: &hir::Expr<'_>, arg_ty: Ty<'tcx>) {
1414
if_chain! {
1515
if let Some(to_string_meth_did) = cx.typeck_results().type_dependent_def_id(expr.hir_id);
1616
if match_def_path(cx, to_string_meth_did, &paths::TO_STRING_METHOD);

clippy_lints/src/methods/inspect_for_each.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::utils::{match_trait_method, paths, span_lint_and_help};
77
use super::INSPECT_FOR_EACH;
88

99
/// lint use of `inspect().for_each()` for `Iterators`
10-
pub(super) fn lint<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, inspect_span: Span) {
10+
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, inspect_span: Span) {
1111
if match_trait_method(cx, expr, &paths::ITERATOR) {
1212
let msg = "called `inspect(..).for_each(..)` on an `Iterator`";
1313
let hint = "move the code from `inspect(..)` to `for_each(..)` and remove the `inspect(..)`";

clippy_lints/src/methods/iter_count.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_span::sym;
88

99
use super::ITER_COUNT;
1010

11-
pub(crate) fn lints<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, iter_args: &'tcx [Expr<'tcx>], iter_method: &str) {
11+
pub(crate) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, iter_args: &'tcx [Expr<'tcx>], iter_method: &str) {
1212
let ty = cx.typeck_results().expr_ty(&iter_args[0]);
1313
let caller_type = if derefs_to_slice(cx, &iter_args[0], ty).is_some() {
1414
"slice"

clippy_lints/src/methods/manual_saturating_arithmetic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_hir as hir;
66
use rustc_lint::LateContext;
77
use rustc_target::abi::LayoutOf;
88

9-
pub fn lint(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[&[hir::Expr<'_>]], arith: &str) {
9+
pub fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[&[hir::Expr<'_>]], arith: &str) {
1010
let unwrap_arg = &args[0][1];
1111
let arith_lhs = &args[1][0];
1212
let arith_rhs = &args[1][1];

clippy_lints/src/methods/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,14 +1673,14 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
16731673
},
16741674
["map_or", ..] => lint_map_or_none(cx, expr, arg_lists[0]),
16751675
["and_then", ..] => {
1676-
let biom_option_linted = bind_instead_of_map::OptionAndThenSome::lint(cx, expr, arg_lists[0]);
1677-
let biom_result_linted = bind_instead_of_map::ResultAndThenOk::lint(cx, expr, arg_lists[0]);
1676+
let biom_option_linted = bind_instead_of_map::OptionAndThenSome::check(cx, expr, arg_lists[0]);
1677+
let biom_result_linted = bind_instead_of_map::ResultAndThenOk::check(cx, expr, arg_lists[0]);
16781678
if !biom_option_linted && !biom_result_linted {
16791679
unnecessary_lazy_eval::check(cx, expr, arg_lists[0], "and");
16801680
}
16811681
},
16821682
["or_else", ..] => {
1683-
if !bind_instead_of_map::ResultOrElseErrInfo::lint(cx, expr, arg_lists[0]) {
1683+
if !bind_instead_of_map::ResultOrElseErrInfo::check(cx, expr, arg_lists[0]) {
16841684
unnecessary_lazy_eval::check(cx, expr, arg_lists[0], "or");
16851685
}
16861686
},
@@ -1703,12 +1703,12 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
17031703
lint_search_is_some(cx, expr, "rposition", arg_lists[1], arg_lists[0], method_spans[1])
17041704
},
17051705
["extend", ..] => lint_extend(cx, expr, arg_lists[0]),
1706-
["count", "into_iter"] => iter_count::lints(cx, expr, &arg_lists[1], "into_iter"),
1707-
["count", "iter"] => iter_count::lints(cx, expr, &arg_lists[1], "iter"),
1708-
["count", "iter_mut"] => iter_count::lints(cx, expr, &arg_lists[1], "iter_mut"),
1706+
["count", "into_iter"] => iter_count::check(cx, expr, &arg_lists[1], "into_iter"),
1707+
["count", "iter"] => iter_count::check(cx, expr, &arg_lists[1], "iter"),
1708+
["count", "iter_mut"] => iter_count::check(cx, expr, &arg_lists[1], "iter_mut"),
17091709
["nth", "iter"] => lint_iter_nth(cx, expr, &arg_lists, false),
17101710
["nth", "iter_mut"] => lint_iter_nth(cx, expr, &arg_lists, true),
1711-
["nth", "bytes"] => bytes_nth::lints(cx, expr, &arg_lists[1]),
1711+
["nth", "bytes"] => bytes_nth::check(cx, expr, &arg_lists[1]),
17121712
["nth", ..] => lint_iter_nth_zero(cx, expr, arg_lists[0]),
17131713
["step_by", ..] => lint_step_by(cx, expr, arg_lists[0]),
17141714
["next", "skip"] => lint_iter_skip_next(cx, expr, arg_lists[1]),
@@ -1717,13 +1717,13 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
17171717
["as_mut"] => lint_asref(cx, expr, "as_mut", arg_lists[0]),
17181718
["fold", ..] => lint_unnecessary_fold(cx, expr, arg_lists[0], method_spans[0]),
17191719
["filter_map", ..] => {
1720-
unnecessary_filter_map::lint(cx, expr, arg_lists[0]);
1720+
unnecessary_filter_map::check(cx, expr, arg_lists[0]);
17211721
filter_map_identity::check(cx, expr, arg_lists[0], method_spans[0]);
17221722
},
17231723
["count", "map"] => suspicious_map::check(cx, expr),
17241724
["assume_init"] => uninit_assumed_init::check(cx, &arg_lists[0][0], expr),
17251725
["unwrap_or", arith @ ("checked_add" | "checked_sub" | "checked_mul")] => {
1726-
manual_saturating_arithmetic::lint(cx, expr, &arg_lists, &arith["checked_".len()..])
1726+
manual_saturating_arithmetic::check(cx, expr, &arg_lists, &arith["checked_".len()..])
17271727
},
17281728
["add" | "offset" | "sub" | "wrapping_offset" | "wrapping_add" | "wrapping_sub"] => {
17291729
check_pointer_offset(cx, expr, arg_lists[0])
@@ -1739,7 +1739,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
17391739
["get_or_insert_with", ..] => unnecessary_lazy_eval::check(cx, expr, arg_lists[0], "get_or_insert"),
17401740
["ok_or_else", ..] => unnecessary_lazy_eval::check(cx, expr, arg_lists[0], "ok_or"),
17411741
["collect", "map"] => lint_map_collect(cx, expr, arg_lists[1], arg_lists[0]),
1742-
["for_each", "inspect"] => inspect_for_each::lint(cx, expr, method_spans[1]),
1742+
["for_each", "inspect"] => inspect_for_each::check(cx, expr, method_spans[1]),
17431743
["to_owned", ..] => implicit_clone::check(cx, expr, sym::ToOwned),
17441744
["to_os_string", ..] => implicit_clone::check(cx, expr, sym::OsStr),
17451745
["to_path_buf", ..] => implicit_clone::check(cx, expr, sym::Path),
@@ -1765,7 +1765,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
17651765
lint_clone_on_ref_ptr(cx, expr, &args[0]);
17661766
}
17671767
if args.len() == 1 && method_call.ident.name == sym!(to_string) {
1768-
inefficient_to_string::lint(cx, expr, &args[0], self_ty);
1768+
inefficient_to_string::check(cx, expr, &args[0], self_ty);
17691769
}
17701770

17711771
if let Some(fn_def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) {

clippy_lints/src/methods/unnecessary_filter_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use if_chain::if_chain;
99

1010
use super::UNNECESSARY_FILTER_MAP;
1111

12-
pub(super) fn lint(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[hir::Expr<'_>]) {
12+
pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[hir::Expr<'_>]) {
1313
if !match_trait_method(cx, expr, &paths::ITERATOR) {
1414
return;
1515
}

0 commit comments

Comments
 (0)