diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2025-04-08 09:56:08 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2025-04-08 09:56:45 +0200 |
| commit | f5122ae4fd0abff0993a67fb9f5f06295703de3b (patch) | |
| tree | 484fb1b371c892eda0b4ad77bf3976664d80fe79 | |
| parent | f74d7ce81371b2573d7a356408251fa4cac3f8d2 (diff) | |
| download | rust-f5122ae4fd0abff0993a67fb9f5f06295703de3b.tar.gz rust-f5122ae4fd0abff0993a67fb9f5f06295703de3b.zip | |
Add doc for the `clippy_lints::methods::derefs_to_slice()` helper
| -rw-r--r-- | clippy_lints/src/methods/utils.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clippy_lints/src/methods/utils.rs b/clippy_lints/src/methods/utils.rs index 3611b341897..b0cc7a785bc 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>, |
