Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clippy_lints/src/cognitive_complexity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl_lint_pass!(CognitiveComplexity => [COGNITIVE_COMPLEXITY]);

impl CognitiveComplexity {
fn check<'tcx>(
&mut self,
&self,
cx: &LateContext<'tcx>,
kind: FnKind<'tcx>,
decl: &'tcx FnDecl<'_>,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/manual_let_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ declare_clippy_lint! {
}

impl<'tcx> QuestionMark {
pub(crate) fn check_manual_let_else(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'tcx>) {
pub(crate) fn check_manual_let_else(&self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'tcx>) {
if let StmtKind::Let(local) = stmt.kind
&& let Some(init) = local.init
&& local.els.is_none()
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/matches/match_str_case_mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl<'tcx> Visitor<'tcx> for MatchExprVisitor<'_, 'tcx> {
}

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

Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/methods/filter_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ enum CheckResult<'tcx> {

impl<'tcx> OffendingFilterExpr<'tcx> {
pub fn check_map_call(
&mut self,
&self,
cx: &LateContext<'tcx>,
map_body: &'tcx Body<'tcx>,
map_param_id: HirId,
Expand Down Expand Up @@ -413,7 +413,7 @@ fn is_find_or_filter<'a>(
}

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

&& let ExprKind::Closure(&Closure { body: map_body_id, .. }) = map_arg.kind
&& let map_body = cx.tcx.hir_body(map_body_id)
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/mixed_read_write_in_expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl<'tcx> DivergenceVisitor<'_, 'tcx> {
}
}

fn report_diverging_sub_expr(&mut self, e: &Expr<'_>) {
fn report_diverging_sub_expr(&self, e: &Expr<'_>) {
if let Some(macro_call) = root_macro_call_first_node(self.cx, e)
&& self.cx.tcx.is_diagnostic_item(sym::todo_macro, macro_call.def_id)
{
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/only_used_in_recursion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl Params {
}

/// Sets the `apply_lint` flag on each parameter.
fn flag_for_linting(&mut self) {
fn flag_for_linting(&self) {
// Stores the list of parameters currently being resolved. Needed to avoid cycles.
let mut eval_stack = Vec::new();
for param in &self.params {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/operators/arithmetic_side_effects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ impl ArithmeticSideEffects {
self.issue_lint(cx, expr);
}

fn should_skip_expr<'tcx>(&mut self, cx: &LateContext<'tcx>, expr: &hir::Expr<'tcx>) -> bool {
fn should_skip_expr<'tcx>(&self, cx: &LateContext<'tcx>, expr: &hir::Expr<'tcx>) -> bool {
is_lint_allowed(cx, ARITHMETIC_SIDE_EFFECTS, expr.hir_id)
|| self.expr_span.is_some()
|| self.const_span.is_some_and(|sp| sp.contains(expr.span))
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/operators/numeric_arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct Context {
const_span: Option<Span>,
}
impl Context {
fn skip_expr(&mut self, e: &hir::Expr<'_>) -> bool {
fn skip_expr(&self, e: &hir::Expr<'_>) -> bool {
self.expr_id.is_some() || self.const_span.is_some_and(|span| span.contains(e.span))
}

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/pass_by_ref_or_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl PassByRefOrValue {
}
}

fn check_poly_fn(&mut self, cx: &LateContext<'_>, def_id: LocalDefId, decl: &FnDecl<'_>, span: Option<Span>) {
fn check_poly_fn(&self, cx: &LateContext<'_>, def_id: LocalDefId, decl: &FnDecl<'_>, span: Option<Span>) {
if self.avoid_breaking_exported_api && cx.effective_visibilities.is_exported(def_id) {
return;
}
Expand Down
10 changes: 1 addition & 9 deletions clippy_lints/src/raw_strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,7 @@ impl EarlyLintPass for RawStrings {
}

impl RawStrings {
fn check_raw_string(
&mut self,
cx: &EarlyContext<'_>,
str: &str,
lit_span: Span,
prefix: &str,
max: u8,
descr: &str,
) {
fn check_raw_string(&self, cx: &EarlyContext<'_>, str: &str, lit_span: Span, prefix: &str, max: u8, descr: &str) {
if !str.contains(['\\', '"']) {
span_lint_and_then(
cx,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ impl<'tcx> IndexBinding<'_, 'tcx> {
}
}

fn is_used_other_than_swapping(&mut self, idx_ident: Ident) -> bool {
fn is_used_other_than_swapping(&self, idx_ident: Ident) -> bool {
if Self::is_used_slice_indexed(self.swap1_idx, idx_ident)
|| Self::is_used_slice_indexed(self.swap2_idx, idx_ident)
{
Expand All @@ -389,7 +389,7 @@ impl<'tcx> IndexBinding<'_, 'tcx> {
self.is_used_after_swap(idx_ident)
}

fn is_used_after_swap(&mut self, idx_ident: Ident) -> bool {
fn is_used_after_swap(&self, idx_ident: Ident) -> bool {
let mut v = IndexBindingVisitor {
idx: idx_ident,
suggest_span: self.suggest_span,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/unnecessary_box_returns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl UnnecessaryBoxReturns {
}
}

fn check_fn_item(&mut self, cx: &LateContext<'_>, decl: &FnDecl<'_>, def_id: LocalDefId, name: Symbol) {
fn check_fn_item(&self, cx: &LateContext<'_>, decl: &FnDecl<'_>, def_id: LocalDefId, name: Symbol) {
// we don't want to tell someone to break an exported function if they ask us not to
if self.avoid_breaking_exported_api && cx.effective_visibilities.is_exported(def_id) {
return;
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/src/hir_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ impl HirEqInterExpr<'_, '_, '_> {
})
}

fn should_ignore(&mut self, expr: &Expr<'_>) -> bool {
fn should_ignore(&self, expr: &Expr<'_>) -> bool {
macro_backtrace(expr.span).last().is_some_and(|macro_call| {
matches!(
self.inner.cx.tcx.get_diagnostic_name(macro_call.def_id),
Expand Down