Skip to content

Commit

Permalink
Merge #615
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bors[bot] and phimuemue committed Jun 2, 2022
2 parents 1cb2c36 + ca28006 commit 1f0a8c1
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/adaptors/coalesce.rs
Expand Up @@ -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<I, F, T>
where
I: Iterator,
Expand Down Expand Up @@ -86,7 +87,6 @@ impl<I: Iterator, F: CoalescePredicate<I::Item, T>, 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<I, F> = CoalesceBy<I, F, <I as Iterator>::Item>;

impl<F, Item, T> CoalescePredicate<Item, T> for F
Expand All @@ -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<I, Pred> = CoalesceBy<I, DedupPred2CoalescePred<Pred>, <I as Iterator>::Item>;

#[derive(Clone)]
Expand Down Expand Up @@ -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<I, Pred> =
CoalesceBy<I, DedupPredWithCount2CoalescePred<Pred>, (usize, <I as Iterator>::Item)>;

Expand Down
1 change: 0 additions & 1 deletion src/adaptors/mod.rs
Expand Up @@ -490,7 +490,6 @@ impl<T: PartialOrd> MergePredicate<T> 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<I, J> = MergeBy<I, J, MergeLte>;

/// Create an iterator that merges elements in `i` and `j`.
Expand Down
1 change: 0 additions & 1 deletion src/duplicates_impl.rs
Expand Up @@ -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<I, V, F> = private::DuplicatesBy<I, V, private::ByFn<F>>;

/// Create a new `DuplicatesBy` iterator.
Expand Down
1 change: 0 additions & 1 deletion src/flatten_ok.rs
Expand Up @@ -138,7 +138,6 @@ where
T: IntoIterator,
T::IntoIter: Clone,
{
#[inline]
clone_fields!(iter, inner_front, inner_back);
}

Expand Down
1 change: 0 additions & 1 deletion src/grouping_map.rs
Expand Up @@ -39,7 +39,6 @@ pub fn new<I, K, V>(iter: I) -> GroupingMap<I>
/// `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<I, F> = GroupingMap<MapForGrouping<I, F>>;

/// `GroupingMap` is an intermediate struct for efficient group-and-fold operations.
Expand Down
1 change: 1 addition & 0 deletions src/impl_macros.rs
Expand Up @@ -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(),)*
Expand Down
1 change: 0 additions & 1 deletion src/kmerge_impl.rs
Expand Up @@ -104,7 +104,6 @@ fn sift_down<T, S>(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<I> = KMergeBy<I, KMergeByLt>;

pub trait KMergePredicate<T> {
Expand Down
1 change: 0 additions & 1 deletion src/rciter_impl.rs
Expand Up @@ -51,7 +51,6 @@ pub fn rciter<I>(iterable: I) -> RcIter<I::IntoIter>
}

impl<I> Clone for RcIter<I> {
#[inline]
clone_fields!(rciter);
}

Expand Down

0 comments on commit 1f0a8c1

Please sign in to comment.