RS.CLIPPY.EXPLICIT_AUTO_DEREF

Dereferencing when the compiler would automatically dereference

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

What it does

Checks for dereferencing expressions which would be covered by auto-deref.

Why is this bad?

This unnecessarily complicates the code.

Example

let x = String::new();
let y: &str = &*x;

Use instead:

let x = String::new();
let y: &str = &x;