From 0978d165f32c637921498baaf9a9d3d9a597be5d Mon Sep 17 00:00:00 2001 From: Young-Flash Date: Fri, 23 Feb 2024 21:03:23 +0800 Subject: [PATCH] add test case --- .../replace_filter_map_next_with_find_map.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/ide-diagnostics/src/handlers/replace_filter_map_next_with_find_map.rs b/crates/ide-diagnostics/src/handlers/replace_filter_map_next_with_find_map.rs index 6d3dcf31ab4..87932bf989f 100644 --- a/crates/ide-diagnostics/src/handlers/replace_filter_map_next_with_find_map.rs +++ b/crates/ide-diagnostics/src/handlers/replace_filter_map_next_with_find_map.rs @@ -80,6 +80,21 @@ fn foo() { ); } + #[test] + fn replace_filter_map_next_dont_work_for_not_sized_issues_16596() { + check_diagnostics( + r#" +//- minicore: iterators +fn foo() { + let mut j = [0].into_iter(); + let i: &mut dyn Iterator = &mut j; + let dummy_fn = |v| (v > 0).then_some(v + 1); + let _res = i.filter_map(dummy_fn).next(); +} +"#, + ); + } + #[test] fn replace_filter_map_next_with_find_map_no_diagnostic_without_next() { check_diagnostics(