RS.CLIPPY.UNNECESSARY_MUT_PASSED

An argument passed as a mutable reference although the callee only demands an immutable reference

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: unnecessary_mut_passed. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Detects passing a mutable reference to a function that only requires an immutable reference.

Why is this bad?

The mutable reference rules out all other references to the value. Also the code misleads about the intent of the call site.

Example

vec.push(&mut value);

Use instead:

vec.push(&value);