Skip to content

Commit 64d6f82

Browse files
committed
Cut needless mut
1 parent 0e4ce7f commit 64d6f82

13 files changed

+15
-23
lines changed

clippy_lints/src/cognitive_complexity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl_lint_pass!(CognitiveComplexity => [COGNITIVE_COMPLEXITY]);
5656

5757
impl CognitiveComplexity {
5858
fn check<'tcx>(
59-
&mut self,
59+
&self,
6060
cx: &LateContext<'tcx>,
6161
kind: FnKind<'tcx>,
6262
decl: &'tcx FnDecl<'_>,

clippy_lints/src/manual_let_else.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ declare_clippy_lint! {
4949
}
5050

5151
impl<'tcx> QuestionMark {
52-
pub(crate) fn check_manual_let_else(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'tcx>) {
52+
pub(crate) fn check_manual_let_else(&self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'tcx>) {
5353
if let StmtKind::Let(local) = stmt.kind
5454
&& let Some(init) = local.init
5555
&& local.els.is_none()

clippy_lints/src/matches/match_str_case_mismatch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<'tcx> Visitor<'tcx> for MatchExprVisitor<'_, 'tcx> {
5454
}
5555

5656
impl MatchExprVisitor<'_, '_> {
57-
fn case_altered(&mut self, segment_ident: Symbol, receiver: &Expr<'_>) -> ControlFlow<CaseMethod> {
57+
fn case_altered(&self, segment_ident: Symbol, receiver: &Expr<'_>) -> ControlFlow<CaseMethod> {
5858
if let Some(case_method) = get_case_method(segment_ident) {
5959
let ty = self.cx.typeck_results().expr_ty(receiver).peel_refs();
6060

clippy_lints/src/methods/filter_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ enum CheckResult<'tcx> {
106106

107107
impl<'tcx> OffendingFilterExpr<'tcx> {
108108
pub fn check_map_call(
109-
&mut self,
109+
&self,
110110
cx: &LateContext<'tcx>,
111111
map_body: &'tcx Body<'tcx>,
112112
map_param_id: HirId,
@@ -413,7 +413,7 @@ fn is_find_or_filter<'a>(
413413
}
414414

415415
&& let PatKind::Binding(_, filter_param_id, _, None) = filter_pat.kind
416-
&& let Some(mut offending_expr) = OffendingFilterExpr::hir(cx, filter_body.value, filter_param_id)
416+
&& let Some(offending_expr) = OffendingFilterExpr::hir(cx, filter_body.value, filter_param_id)
417417

418418
&& let ExprKind::Closure(&Closure { body: map_body_id, .. }) = map_arg.kind
419419
&& let map_body = cx.tcx.hir_body(map_body_id)

clippy_lints/src/mixed_read_write_in_expression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl<'tcx> DivergenceVisitor<'_, 'tcx> {
134134
}
135135
}
136136

137-
fn report_diverging_sub_expr(&mut self, e: &Expr<'_>) {
137+
fn report_diverging_sub_expr(&self, e: &Expr<'_>) {
138138
if let Some(macro_call) = root_macro_call_first_node(self.cx, e)
139139
&& self.cx.tcx.is_diagnostic_item(sym::todo_macro, macro_call.def_id)
140140
{

clippy_lints/src/only_used_in_recursion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl Params {
173173
}
174174

175175
/// Sets the `apply_lint` flag on each parameter.
176-
fn flag_for_linting(&mut self) {
176+
fn flag_for_linting(&self) {
177177
// Stores the list of parameters currently being resolved. Needed to avoid cycles.
178178
let mut eval_stack = Vec::new();
179179
for param in &self.params {

clippy_lints/src/operators/arithmetic_side_effects.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ impl ArithmeticSideEffects {
325325
self.issue_lint(cx, expr);
326326
}
327327

328-
fn should_skip_expr<'tcx>(&mut self, cx: &LateContext<'tcx>, expr: &hir::Expr<'tcx>) -> bool {
328+
fn should_skip_expr<'tcx>(&self, cx: &LateContext<'tcx>, expr: &hir::Expr<'tcx>) -> bool {
329329
is_lint_allowed(cx, ARITHMETIC_SIDE_EFFECTS, expr.hir_id)
330330
|| self.expr_span.is_some()
331331
|| self.const_span.is_some_and(|sp| sp.contains(expr.span))

clippy_lints/src/operators/numeric_arithmetic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct Context {
1313
const_span: Option<Span>,
1414
}
1515
impl Context {
16-
fn skip_expr(&mut self, e: &hir::Expr<'_>) -> bool {
16+
fn skip_expr(&self, e: &hir::Expr<'_>) -> bool {
1717
self.expr_id.is_some() || self.const_span.is_some_and(|span| span.contains(e.span))
1818
}
1919

clippy_lints/src/pass_by_ref_or_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl PassByRefOrValue {
120120
}
121121
}
122122

123-
fn check_poly_fn(&mut self, cx: &LateContext<'_>, def_id: LocalDefId, decl: &FnDecl<'_>, span: Option<Span>) {
123+
fn check_poly_fn(&self, cx: &LateContext<'_>, def_id: LocalDefId, decl: &FnDecl<'_>, span: Option<Span>) {
124124
if self.avoid_breaking_exported_api && cx.effective_visibilities.is_exported(def_id) {
125125
return;
126126
}

clippy_lints/src/raw_strings.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,7 @@ impl EarlyLintPass for RawStrings {
103103
}
104104

105105
impl RawStrings {
106-
fn check_raw_string(
107-
&mut self,
108-
cx: &EarlyContext<'_>,
109-
str: &str,
110-
lit_span: Span,
111-
prefix: &str,
112-
max: u8,
113-
descr: &str,
114-
) {
106+
fn check_raw_string(&self, cx: &EarlyContext<'_>, str: &str, lit_span: Span, prefix: &str, max: u8, descr: &str) {
115107
if !str.contains(['\\', '"']) {
116108
span_lint_and_then(
117109
cx,

0 commit comments

Comments
 (0)