Skip to content

refactor: apply clippy::needless_borrow#6921

Closed
shulaoda wants to merge 1 commit into
rust-lang:mainfrom
shulaoda:05-23-refactor_apply_clippy_needless_borrow
Closed

refactor: apply clippy::needless_borrow#6921
shulaoda wants to merge 1 commit into
rust-lang:mainfrom
shulaoda:05-23-refactor_apply_clippy_needless_borrow

Conversation

@shulaoda
Copy link
Copy Markdown
Contributor

Summary

  • Removes 12 redundant & borrows where the callee already takes a reference, across src/chains.rs, src/expr.rs, src/format_report_formatter.rs, src/items.rs, src/macros.rs, src/overflow.rs, src/sort.rs, and src/types.rs.
  • Addresses clippy::needless_borrow, run as a single-rule pass: cargo clippy -- -A clippy::all -W clippy::needless_borrow.

Representative changes:

  • rewrite_paren(context, &expr, …)rewrite_paren(context, expr, …)
  • rewrite_call(context, &callee_str, &args, …)… , args, …
  • rewrite_where_clause(context, &after_where_clause, …)… , after_where_clause, …
  • rewrite_generics(context, …, &fn_sig.generics, …)… , fn_sig.generics, …
  • maybe_get_args_offset(…, &self.context.config)… , self.context.config
  • ca.cmp(&cb)ca.cmp(cb) (and similar)
  • first_line_width(&pred_str)first_line_width(pred_str)

In every case the argument was already an &T, so the extra & was reborrowed to the same type — no observable change.

@rustbot rustbot added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label May 22, 2026
@ytmimi
Copy link
Copy Markdown
Contributor

ytmimi commented May 22, 2026

Going to close until we decide on which clippy lints we want to enforce in the codebase.

@ytmimi ytmimi closed this May 22, 2026
@rustbot rustbot removed the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants