Skip to content

Commit e0ff587

Browse files
committed
Enable needless_pass_by_ref_mut
1 parent f6daa39 commit e0ff587

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

clippy_dev/src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub struct File<'a> {
5858
impl<'a> File<'a> {
5959
/// Opens a file panicking on failure.
6060
#[track_caller]
61-
pub fn open(path: &'a (impl AsRef<Path> + ?Sized), options: &mut OpenOptions) -> Self {
61+
pub fn open(path: &'a (impl AsRef<Path> + ?Sized), options: &OpenOptions) -> Self {
6262
let path = path.as_ref();
6363
Self {
6464
inner: expect_action(options.open(path), ErrAction::Open, path),
@@ -68,7 +68,7 @@ impl<'a> File<'a> {
6868

6969
/// Opens a file if it exists, panicking on any other failure.
7070
#[track_caller]
71-
pub fn open_if_exists(path: &'a (impl AsRef<Path> + ?Sized), options: &mut OpenOptions) -> Option<Self> {
71+
pub fn open_if_exists(path: &'a (impl AsRef<Path> + ?Sized), options: &OpenOptions) -> Option<Self> {
7272
let path = path.as_ref();
7373
match options.open(path) {
7474
Ok(inner) => Some(Self { inner, path }),

clippy_lints/src/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ enum VecToArray {
106106
impl UselessVec {
107107
/// Checks if the surrounding environment requires this expression to actually be of type
108108
/// `Vec<_>`, or if it can be changed to `&[]`/`[]` without causing type errors.
109-
fn expr_usage_requires_vec(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) -> VecToArray {
109+
fn expr_usage_requires_vec(&self, cx: &LateContext<'_>, expr: &Expr<'_>) -> VecToArray {
110110
match cx.tcx.parent_hir_node(expr.hir_id) {
111111
// search for `let foo = vec![_]` expressions where all uses of `foo`
112112
// adjust to slices or call a method that exist on slices (e.g. len)

tests/dogfood.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ fn run_clippy_for_package(project: &str) -> bool {
9191
"clippy::pedantic",
9292
"-D",
9393
"clippy::dbg_macro",
94+
"-D",
95+
"clippy::needless_pass_by_ref_mut",
9496
]);
9597
if !cfg!(feature = "internal") {
9698
// running a clippy built without internal lints on the clippy source

0 commit comments

Comments
 (0)