From 540e116a38cefcb4eb50d190304fd67ddc9882cd Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Tue, 29 Oct 2024 19:48:09 +0100 Subject: [PATCH] Return iterator must not capture lifetimes in Rust 2024 In Rust 2024, by default lifetimes will be captured which does not reflect the reality since we return an iterator of `DefId` which do not capture the input parameters. --- clippy_utils/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 65e6f8847bc..d175913a5fe 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -745,7 +745,7 @@ pub fn def_path_res_with_base(tcx: TyCtxt<'_>, mut base: Vec, mut path: &[& } /// Resolves a def path like `std::vec::Vec` to its [`DefId`]s, see [`def_path_res`]. -pub fn def_path_def_ids(tcx: TyCtxt<'_>, path: &[&str]) -> impl Iterator { +pub fn def_path_def_ids(tcx: TyCtxt<'_>, path: &[&str]) -> impl Iterator + use<> { def_path_res(tcx, path).into_iter().filter_map(|res| res.opt_def_id()) }