Skip to content

Commit 1f0a8c1

Browse files
bors[bot]phimuemue
andauthored
Merge #615
615: Avoid warning r=phimuemue a=phimuemue Fixes two warnings that would clutter output. * `#[inline]` not meaningful before macro call. I pulled it into the macro, but with a TODO asking whether this is sensible. As far as I know, we do not have an established guideline for this, so I thought it's ok to leave it in there. * `#[must_use]` not meaningful on type alias. Pulled to the original type where not present before. Co-authored-by: philipp <descpl@yahoo.de>
2 parents 1cb2c36 + ca28006 commit 1f0a8c1

File tree

8 files changed

+2
-9
lines changed

8 files changed

+2
-9
lines changed

src/adaptors/coalesce.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::iter::FusedIterator;
33

44
use crate::size_hint;
55

6+
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
67
pub struct CoalesceBy<I, F, T>
78
where
89
I: Iterator,
@@ -86,7 +87,6 @@ impl<I: Iterator, F: CoalescePredicate<I::Item, T>, T> FusedIterator for Coalesc
8687
/// An iterator adaptor that may join together adjacent elements.
8788
///
8889
/// See [`.coalesce()`](crate::Itertools::coalesce) for more information.
89-
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
9090
pub type Coalesce<I, F> = CoalesceBy<I, F, <I as Iterator>::Item>;
9191

9292
impl<F, Item, T> CoalescePredicate<Item, T> for F
@@ -113,7 +113,6 @@ where
113113
/// An iterator adaptor that removes repeated duplicates, determining equality using a comparison function.
114114
///
115115
/// See [`.dedup_by()`](crate::Itertools::dedup_by) or [`.dedup()`](crate::Itertools::dedup) for more information.
116-
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
117116
pub type DedupBy<I, Pred> = CoalesceBy<I, DedupPred2CoalescePred<Pred>, <I as Iterator>::Item>;
118117

119118
#[derive(Clone)]
@@ -186,7 +185,6 @@ where
186185
///
187186
/// See [`.dedup_by_with_count()`](crate::Itertools::dedup_by_with_count) or
188187
/// [`.dedup_with_count()`](crate::Itertools::dedup_with_count) for more information.
189-
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
190188
pub type DedupByWithCount<I, Pred> =
191189
CoalesceBy<I, DedupPredWithCount2CoalescePred<Pred>, (usize, <I as Iterator>::Item)>;
192190

src/adaptors/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,6 @@ impl<T: PartialOrd> MergePredicate<T> for MergeLte {
490490
/// Iterator element type is `I::Item`.
491491
///
492492
/// See [`.merge()`](crate::Itertools::merge_by) for more information.
493-
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
494493
pub type Merge<I, J> = MergeBy<I, J, MergeLte>;
495494

496495
/// Create an iterator that merges elements in `i` and `j`.

src/duplicates_impl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ mod private {
188188
/// An iterator adapter to filter for duplicate elements.
189189
///
190190
/// See [`.duplicates_by()`](crate::Itertools::duplicates_by) for more information.
191-
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
192191
pub type DuplicatesBy<I, V, F> = private::DuplicatesBy<I, V, private::ByFn<F>>;
193192

194193
/// Create a new `DuplicatesBy` iterator.

src/flatten_ok.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ where
138138
T: IntoIterator,
139139
T::IntoIter: Clone,
140140
{
141-
#[inline]
142141
clone_fields!(iter, inner_front, inner_back);
143142
}
144143

src/grouping_map.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub fn new<I, K, V>(iter: I) -> GroupingMap<I>
3939
/// `GroupingMapBy` is an intermediate struct for efficient group-and-fold operations.
4040
///
4141
/// See [`GroupingMap`] for more informations.
42-
#[must_use = "GroupingMapBy is lazy and do nothing unless consumed"]
4342
pub type GroupingMapBy<I, F> = GroupingMap<MapForGrouping<I, F>>;
4443

4544
/// `GroupingMap` is an intermediate struct for efficient group-and-fold operations.

src/impl_macros.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ macro_rules! debug_fmt_fields {
1515

1616
macro_rules! clone_fields {
1717
($($field:ident),*) => {
18+
#[inline] // TODO is this sensible?
1819
fn clone(&self) -> Self {
1920
Self {
2021
$($field: self.$field.clone(),)*

src/kmerge_impl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ fn sift_down<T, S>(heap: &mut [T], index: usize, mut less_than: S)
104104
/// Iterator element type is `I::Item`.
105105
///
106106
/// See [`.kmerge()`](crate::Itertools::kmerge) for more information.
107-
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
108107
pub type KMerge<I> = KMergeBy<I, KMergeByLt>;
109108

110109
pub trait KMergePredicate<T> {

src/rciter_impl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ pub fn rciter<I>(iterable: I) -> RcIter<I::IntoIter>
5151
}
5252

5353
impl<I> Clone for RcIter<I> {
54-
#[inline]
5554
clone_fields!(rciter);
5655
}
5756

0 commit comments

Comments
 (0)