From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/tools/clippy/tests/ui/iter_skip_next_unfixable.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/tools/clippy/tests/ui/iter_skip_next_unfixable.rs (limited to 'src/tools/clippy/tests/ui/iter_skip_next_unfixable.rs') diff --git a/src/tools/clippy/tests/ui/iter_skip_next_unfixable.rs b/src/tools/clippy/tests/ui/iter_skip_next_unfixable.rs new file mode 100644 index 000000000..3607330cf --- /dev/null +++ b/src/tools/clippy/tests/ui/iter_skip_next_unfixable.rs @@ -0,0 +1,19 @@ +#![warn(clippy::iter_skip_next)] +#![allow(dead_code)] + +/// Checks implementation of `ITER_SKIP_NEXT` lint +fn main() { + // fix #8128 + let test_string = "1|1 2"; + let sp = test_string.split('|').map(|s| s.trim()); + let _: Vec<&str> = sp.skip(1).next().unwrap().split(' ').collect(); + if let Some(s) = Some(test_string.split('|').map(|s| s.trim())) { + let _: Vec<&str> = s.skip(1).next().unwrap().split(' ').collect(); + }; + fn check(s: T) + where + T: Iterator, + { + let _: Vec<&str> = s.skip(1).next().unwrap().split(' ').collect(); + } +} -- cgit v1.2.3