From 6e404f1831ddcd0dc3de8a27cee171f353b99009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 9 Oct 2020 11:00:15 +0300 Subject: [PATCH] gstreamer/meta: Don't collect iterators just to check their length in the tests --- gstreamer/src/meta.rs | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/gstreamer/src/meta.rs b/gstreamer/src/meta.rs index d8d464e19..1363a2620 100644 --- a/gstreamer/src/meta.rs +++ b/gstreamer/src/meta.rs @@ -426,16 +426,12 @@ mod tests { } { - let metas = buffer.iter_meta::().collect::>(); - assert_eq!(metas.len(), 1); + let metas = buffer.iter_meta::(); + assert_eq!(metas.count(), 1); } { - let metas = buffer - .get_mut() - .unwrap() - .iter_meta_mut::() - .collect::>(); - assert_eq!(metas.len(), 1); + let metas = buffer.get_mut().unwrap().iter_meta_mut::(); + assert_eq!(metas.count(), 1); } { let metas = buffer.iter_meta::().collect::>(); @@ -469,28 +465,23 @@ mod tests { } { - let metas = buffer.iter_meta::().collect::>(); - assert_eq!(metas.len(), 0); + let metas = buffer.iter_meta::(); + assert_eq!(metas.count(), 0); + } + { + let metas = buffer.get_mut().unwrap().iter_meta_mut::(); + assert_eq!(metas.count(), 0); + } + { + let metas = buffer.iter_meta::(); + assert_eq!(metas.count(), 0); } { let metas = buffer .get_mut() .unwrap() - .iter_meta_mut::() - .collect::>(); - assert_eq!(metas.len(), 0); - } - { - let metas = buffer.iter_meta::().collect::>(); - assert_eq!(metas.len(), 0); - } - { - let metas = buffer - .get_mut() - .unwrap() - .iter_meta_mut::() - .collect::>(); - assert_eq!(metas.len(), 0); + .iter_meta_mut::(); + assert_eq!(metas.count(), 0); } assert!(buffer.get_meta::().is_none());