From 9f83f904d490e64306f1f288234221aab9d57dd9 Mon Sep 17 00:00:00 2001 From: Stefan Kreutz Date: Mon, 19 Dec 2022 12:08:20 +0100 Subject: Add must_use attribute to iterator trait and impl --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 3442f58..7022d37 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -42,6 +42,7 @@ use std::{collections::HashMap, num::NonZeroUsize}; use crossbeam_channel::{Receiver, Select, Sender, TryRecvError}; /// An extension trait adding parallel sequential mapping to the standard [`Iterator`] trait. +#[must_use = "iterators are lazy and do nothing unless consumed"] pub trait ParallelIterator { /// Creates an iterator which applies a given closure to each element in parallel. /// @@ -146,6 +147,7 @@ impl ParallelIterator for I where I: Iterator {} /// /// This struct is created by the [`map_parallel`](ParallelIterator::map_parallel) method on the /// [`ParallelIterator`] trait. +#[must_use = "iterators are lazy and do nothing unless consumed"] pub struct ParallelMap where I: Iterator, -- cgit v1.2.3