RS.CLIPPY.REF_BINDING_TO_REFERENCE
`ref` binding to a 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: ref_binding_to_reference. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for ref bindings which create a reference to a reference.
Why is this bad?
The address-of operator at the use site is clearer about the need for a reference.
Example
let x = Some("");
if let Some(ref x) = x {
// use `x` here
}
Use instead:
let x = Some("");
if let Some(x) = x {
// use `&x` here
}