From 1f73b567eb436368c32e365daf2d102a1ffaa540 Mon Sep 17 00:00:00 2001 From: philipp Date: Mon, 23 May 2022 21:24:38 +0200 Subject: [PATCH 1/2] Pull #[inline] into clone_fields As the warning tells, it has no effect otherwise. It's unclear whether it's really meaningful, but for now keep in within the macro. --- src/flatten_ok.rs | 1 - src/impl_macros.rs | 1 + src/rciter_impl.rs | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/flatten_ok.rs b/src/flatten_ok.rs index 91168406b..cee77c9a6 100644 --- a/src/flatten_ok.rs +++ b/src/flatten_ok.rs @@ -138,7 +138,6 @@ where T: IntoIterator, T::IntoIter: Clone, { - #[inline] clone_fields!(iter, inner_front, inner_back); } diff --git a/src/impl_macros.rs b/src/impl_macros.rs index 5772baeb6..a029843b0 100644 --- a/src/impl_macros.rs +++ b/src/impl_macros.rs @@ -15,6 +15,7 @@ macro_rules! debug_fmt_fields { macro_rules! clone_fields { ($($field:ident),*) => { + #[inline] // TODO is this sensible? fn clone(&self) -> Self { Self { $($field: self.$field.clone(),)* diff --git a/src/rciter_impl.rs b/src/rciter_impl.rs index 782908e28..7298350a8 100644 --- a/src/rciter_impl.rs +++ b/src/rciter_impl.rs @@ -51,7 +51,6 @@ pub fn rciter(iterable: I) -> RcIter } impl Clone for RcIter { - #[inline] clone_fields!(rciter); } From ca28006326d0fc9bfcccd807f2bb53738ed68d0f Mon Sep 17 00:00:00 2001 From: philipp Date: Mon, 23 May 2022 21:29:32 +0200 Subject: [PATCH 2/2] Do not put #[must_use] on type alias As warned by the compiler, it has no effect. --- src/adaptors/coalesce.rs | 4 +--- src/adaptors/mod.rs | 1 - src/duplicates_impl.rs | 1 - src/grouping_map.rs | 1 - src/kmerge_impl.rs | 1 - 5 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/adaptors/coalesce.rs b/src/adaptors/coalesce.rs index b1aff6e27..3df7cc582 100644 --- a/src/adaptors/coalesce.rs +++ b/src/adaptors/coalesce.rs @@ -3,6 +3,7 @@ use std::iter::FusedIterator; use crate::size_hint; +#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pub struct CoalesceBy where I: Iterator, @@ -86,7 +87,6 @@ impl, T> FusedIterator for Coalesc /// An iterator adaptor that may join together adjacent elements. /// /// See [`.coalesce()`](crate::Itertools::coalesce) for more information. -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pub type Coalesce = CoalesceBy::Item>; impl CoalescePredicate for F @@ -113,7 +113,6 @@ where /// An iterator adaptor that removes repeated duplicates, determining equality using a comparison function. /// /// See [`.dedup_by()`](crate::Itertools::dedup_by) or [`.dedup()`](crate::Itertools::dedup) for more information. -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pub type DedupBy = CoalesceBy, ::Item>; #[derive(Clone)] @@ -186,7 +185,6 @@ where /// /// See [`.dedup_by_with_count()`](crate::Itertools::dedup_by_with_count) or /// [`.dedup_with_count()`](crate::Itertools::dedup_with_count) for more information. -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pub type DedupByWithCount = CoalesceBy, (usize, ::Item)>; diff --git a/src/adaptors/mod.rs b/src/adaptors/mod.rs index d324e4a68..19008ccf2 100644 --- a/src/adaptors/mod.rs +++ b/src/adaptors/mod.rs @@ -490,7 +490,6 @@ impl MergePredicate for MergeLte { /// Iterator element type is `I::Item`. /// /// See [`.merge()`](crate::Itertools::merge_by) for more information. -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pub type Merge = MergeBy; /// Create an iterator that merges elements in `i` and `j`. diff --git a/src/duplicates_impl.rs b/src/duplicates_impl.rs index 640d4818c..28eda44a9 100644 --- a/src/duplicates_impl.rs +++ b/src/duplicates_impl.rs @@ -188,7 +188,6 @@ mod private { /// An iterator adapter to filter for duplicate elements. /// /// See [`.duplicates_by()`](crate::Itertools::duplicates_by) for more information. -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pub type DuplicatesBy = private::DuplicatesBy>; /// Create a new `DuplicatesBy` iterator. diff --git a/src/grouping_map.rs b/src/grouping_map.rs index be22ec849..82ba1192b 100644 --- a/src/grouping_map.rs +++ b/src/grouping_map.rs @@ -39,7 +39,6 @@ pub fn new(iter: I) -> GroupingMap /// `GroupingMapBy` is an intermediate struct for efficient group-and-fold operations. /// /// See [`GroupingMap`] for more informations. -#[must_use = "GroupingMapBy is lazy and do nothing unless consumed"] pub type GroupingMapBy = GroupingMap>; /// `GroupingMap` is an intermediate struct for efficient group-and-fold operations. diff --git a/src/kmerge_impl.rs b/src/kmerge_impl.rs index f2280653f..5642b36c9 100644 --- a/src/kmerge_impl.rs +++ b/src/kmerge_impl.rs @@ -104,7 +104,6 @@ fn sift_down(heap: &mut [T], index: usize, mut less_than: S) /// Iterator element type is `I::Item`. /// /// See [`.kmerge()`](crate::Itertools::kmerge) for more information. -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pub type KMerge = KMergeBy; pub trait KMergePredicate {