Skip to content

Commit fea8899

Browse files
committed
fix dogfood
1 parent ece96a4 commit fea8899

File tree

8 files changed

+22
-20
lines changed

8 files changed

+22
-20
lines changed

clippy_lints/src/endian_bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ fn maybe_lint_endian_bytes(cx: &LateContext<'_>, expr: &Expr<'_>, prefix: Prefix
203203
lint.as_name(prefix),
204204
if prefix == Prefix::To { " method" } else { "" },
205205
),
206-
move |diag| {
206+
|diag| {
207207
if let Some(help) = help {
208208
diag.help(help);
209209
}

clippy_lints/src/fallible_impl_from.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fn lint_impl_body(cx: &LateContext<'_>, impl_span: Span, impl_items: &[hir::Impl
116116
FALLIBLE_IMPL_FROM,
117117
impl_span,
118118
"consider implementing `TryFrom` instead",
119-
move |diag| {
119+
|diag| {
120120
diag.help(
121121
"`From` is intended for infallible conversions only. \
122122
Use `TryFrom` if there's a possibility for the conversion to fail",

clippy_lints/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
685685
store.register_late_pass(move |_| Box::new(from_over_into::FromOverInto::new(msrv())));
686686
store.register_late_pass(move |_| Box::new(use_self::UseSelf::new(msrv())));
687687
store.register_late_pass(move |_| Box::new(missing_const_for_fn::MissingConstForFn::new(msrv())));
688-
store.register_late_pass(move |_| Box::new(needless_question_mark::NeedlessQuestionMark));
688+
store.register_late_pass(|_| Box::new(needless_question_mark::NeedlessQuestionMark));
689689
store.register_late_pass(move |_| Box::new(casts::Casts::new(msrv())));
690690
store.register_early_pass(move || Box::new(unnested_or_patterns::UnnestedOrPatterns::new(msrv())));
691691
store.register_late_pass(|_| Box::new(size_of_in_element_count::SizeOfInElementCount));
@@ -752,7 +752,7 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
752752
store.register_late_pass(|_| Box::new(mixed_read_write_in_expression::EvalOrderDependence));
753753
store.register_late_pass(move |_| Box::new(missing_doc::MissingDoc::new(missing_docs_in_crate_items)));
754754
store.register_late_pass(|_| Box::new(missing_inline::MissingInline));
755-
store.register_late_pass(move |_| Box::new(exhaustive_items::ExhaustiveItems));
755+
store.register_late_pass(|_| Box::new(exhaustive_items::ExhaustiveItems));
756756
store.register_late_pass(|_| Box::new(match_result_ok::MatchResultOk));
757757
store.register_late_pass(|_| Box::new(partialeq_ne_impl::PartialEqNeImpl));
758758
store.register_late_pass(|_| Box::new(unused_io_amount::UnusedIoAmount));
@@ -895,7 +895,7 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
895895
store.register_late_pass(|_| Box::new(from_str_radix_10::FromStrRadix10));
896896
store.register_late_pass(move |_| Box::new(if_then_some_else_none::IfThenSomeElseNone::new(msrv())));
897897
store.register_late_pass(|_| Box::new(bool_assert_comparison::BoolAssertComparison));
898-
store.register_early_pass(move || Box::new(module_style::ModStyle));
898+
store.register_early_pass(|| Box::new(module_style::ModStyle));
899899
store.register_late_pass(|_| Box::<unused_async::UnusedAsync>::default());
900900
store.register_late_pass(move |_| Box::new(disallowed_types::DisallowedTypes::new(disallowed_types.clone())));
901901
store.register_late_pass(move |_| {
@@ -905,9 +905,9 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
905905
});
906906
store.register_early_pass(move || Box::new(disallowed_script_idents::DisallowedScriptIdents::new(allowed_scripts)));
907907
store.register_late_pass(|_| Box::new(strlen_on_c_strings::StrlenOnCStrings));
908-
store.register_late_pass(move |_| Box::new(self_named_constructors::SelfNamedConstructors));
909-
store.register_late_pass(move |_| Box::new(iter_not_returning_iterator::IterNotReturningIterator));
910-
store.register_late_pass(move |_| Box::new(manual_assert::ManualAssert));
908+
store.register_late_pass(|_| Box::new(self_named_constructors::SelfNamedConstructors));
909+
store.register_late_pass(|_| Box::new(iter_not_returning_iterator::IterNotReturningIterator));
910+
store.register_late_pass(|_| Box::new(manual_assert::ManualAssert));
911911
store.register_late_pass(move |_| {
912912
Box::new(non_send_fields_in_send_ty::NonSendFieldInSendTy::new(
913913
enable_raw_pointer_heuristic_for_send,

clippy_lints/src/loops/manual_memcpy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ fn get_assignments<'a, 'tcx>(
408408
// just increases complexity. (cc #3188 and #4193)
409409
stmts
410410
.iter()
411-
.filter_map(move |stmt| match stmt.kind {
411+
.filter_map(|stmt| match stmt.kind {
412412
StmtKind::Local(..) | StmtKind::Item(..) => None,
413413
StmtKind::Expr(e) | StmtKind::Semi(e) => Some(e),
414414
})

clippy_lints/src/needless_move.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use clippy_utils::sugg::DiagnosticExt;
33
use clippy_utils::ty::is_copy;
44
use rustc_data_structures::fx::FxIndexMap;
55
use rustc_errors::Applicability;
6-
use rustc_hir::*;
6+
use rustc_hir::{CaptureBy, Closure, Expr, ExprKind, HirId};
77
use rustc_hir_typeck::expr_use_visitor as euv;
88
use rustc_infer::infer::TyCtxtInferExt;
99
use rustc_lint::{LateContext, LateLintPass};
@@ -41,7 +41,7 @@ declare_clippy_lint! {
4141
declare_lint_pass!(NeedlessMove => [NEEDLESS_MOVE]);
4242

4343
impl NeedlessMove {
44-
fn check_closure<'tcx>(&self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, closure: &'tcx Closure<'tcx>) {
44+
fn check_closure<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, closure: &'tcx Closure<'tcx>) {
4545
let CaptureBy::Value { move_kw } = closure.capture_clause else {
4646
return;
4747
};
@@ -58,8 +58,8 @@ impl NeedlessMove {
5858
mut captured_vars,
5959
} = {
6060
let mut ctx = MovedVariablesCtxt {
61-
captured_vars: Default::default(),
62-
moved_vars: Default::default(),
61+
captured_vars: FxIndexMap::default(),
62+
moved_vars: FxIndexMap::default(),
6363
};
6464
let body = cx.tcx.hir().body(closure.body);
6565
let infcx = cx.tcx.infer_ctxt().build();
@@ -70,7 +70,7 @@ impl NeedlessMove {
7070

7171
// Remove the captured vars which were also `move`d.
7272
// See special case 1. below.
73-
for (hir_id, _upvars) in moved_vars.iter() {
73+
for (hir_id, _upvars) in &moved_vars {
7474
let Some(vars) = captured_vars.get_mut(hir_id) else {
7575
continue;
7676
};
@@ -99,9 +99,11 @@ impl NeedlessMove {
9999
};
100100

101101
match (moved_vars.is_empty(), captured_vars.is_empty()) {
102-
(true, true) => lint("there were no captured variables, so the `move` is unnecessary"),
102+
(true, true) => {
103+
lint("there were no captured variables, so the `move` is unnecessary");
104+
},
103105
(false, true) => {
104-
lint("there were consumed variables, but no borrowed variables, so the `move` is unnecessary")
106+
lint("there were consumed variables, but no borrowed variables, so the `move` is unnecessary");
105107
},
106108
(_, false) => {
107109
// captured_vars is not empty, so `move` actually makes a difference and we
@@ -121,7 +123,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessMove {
121123
return;
122124
};
123125

124-
self.check_closure(cx, expr, closure);
126+
Self::check_closure(cx, expr, closure);
125127
}
126128
}
127129

clippy_lints/src/panic_in_result_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn lint_impl_body<'tcx>(cx: &LateContext<'tcx>, impl_span: Span, body: &'tcx hir
8484
PANIC_IN_RESULT_FN,
8585
impl_span,
8686
"used `panic!()` or assertion in a function that returns `Result`",
87-
move |diag| {
87+
|diag| {
8888
diag.help(
8989
"`panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing",
9090
);

clippy_lints/src/unwrap_in_result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fn lint_impl_body<'tcx>(cx: &LateContext<'tcx>, impl_span: Span, impl_item: &'tc
106106
UNWRAP_IN_RESULT,
107107
impl_span,
108108
"used unwrap or expect in a function that returns result or option",
109-
move |diag| {
109+
|diag| {
110110
diag.help("unwrap and expect should not be used in a function that returns result or option");
111111
diag.span_note(result, "potential non-recoverable error(s)");
112112
},

src/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ pub fn main() {
186186
handler.note_without_error(format!("Clippy version: {version_info}"));
187187
});
188188

189-
exit(rustc_driver::catch_with_exit_code(move || {
189+
exit(rustc_driver::catch_with_exit_code(|| {
190190
let mut orig_args: Vec<String> = env::args().collect();
191191
let has_sysroot_arg = arg_value(&orig_args, "--sysroot", |_| true).is_some();
192192

0 commit comments

Comments
 (0)