From f5122ae4fd0abff0993a67fb9f5f06295703de3b Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Tue, 8 Apr 2025 09:56:08 +0200 Subject: [PATCH] Add doc for the `clippy_lints::methods::derefs_to_slice()` helper --- clippy_lints/src/methods/utils.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clippy_lints/src/methods/utils.rs b/clippy_lints/src/methods/utils.rs index 3611b341897a..b0cc7a785bc3 100644 --- a/clippy_lints/src/methods/utils.rs +++ b/clippy_lints/src/methods/utils.rs @@ -8,6 +8,9 @@ use rustc_middle::ty::{self, Ty}; use rustc_span::Span; use rustc_span::symbol::sym; +/// Checks if `expr`, of type `ty`, corresponds to a slice or can be dereferenced to a slice, or if +/// `expr` is a method call to `.iter()` on such a type. In these cases, return the slice-like +/// expression. pub(super) fn derefs_to_slice<'tcx>( cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>,