Skip to content

Commit

Permalink
Merge branch 'master' into Implement-custom-fold-for-zip-longest
Browse files Browse the repository at this point in the history
  • Loading branch information
jswrenn authored Oct 3, 2023
2 parents 7bb6845 + c4358ab commit 3e5395d
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 19 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ name: CI

on:
pull_request:
push:
branches:
- staging
- trying
merge_group:

jobs:
check:
Expand All @@ -22,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo check ${{ matrix.features }}
- run: RUSTFLAGS="--deny warnings" cargo check ${{ matrix.features }}

msrv:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,12 +49,12 @@ jobs:
components: rustfmt
- run: cargo fmt --check

# https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149
end-success:
name: bors build finished
# Used to signal to branch protections that all other jobs have succeeded.
all-jobs-succeed:
name: All checks succeeded
if: success()
runs-on: ubuntu-latest
needs: [check, test]
needs: [check, msrv, test, check-format]
steps:
- name: Mark the job as successful
run: exit 0
2 changes: 2 additions & 0 deletions benches/fold_specialization.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unstable_name_collisions)]

use criterion::{criterion_group, criterion_main, Criterion};
use itertools::Itertools;

Expand Down
2 changes: 2 additions & 0 deletions benches/tree_fold1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(deprecated)]

use criterion::{criterion_group, criterion_main, Criterion};
use itertools::{cloned, Itertools};

Expand Down
2 changes: 2 additions & 0 deletions src/extrema_set.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(feature = "use_alloc")]
use alloc::{vec, vec::Vec};
use std::cmp::Ordering;

/// Implementation guts for `min_set`, `min_set_by`, and `min_set_by_key`.
Expand Down
16 changes: 7 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ use std::hash::Hash;
use std::iter::{once, IntoIterator};
#[cfg(feature = "use_alloc")]
type VecIntoIter<T> = alloc::vec::IntoIter<T>;
#[cfg(feature = "use_alloc")]
use std::iter::FromIterator;

#[macro_use]
Expand Down Expand Up @@ -178,7 +177,7 @@ mod diff;
#[cfg(feature = "use_std")]
mod duplicates_impl;
mod exactly_one_err;
#[cfg(feature = "use_std")]
#[cfg(feature = "use_alloc")]
mod extrema_set;
mod flatten_ok;
mod format;
Expand Down Expand Up @@ -2214,7 +2213,6 @@ pub trait Itertools: Iterator {
/// Ok(())
/// }
/// ```
#[cfg(feature = "use_alloc")]
fn try_collect<T, U, E>(self) -> Result<U, E>
where
Self: Sized + Iterator<Item = Result<T, E>>,
Expand Down Expand Up @@ -3171,7 +3169,7 @@ pub trait Itertools: Iterator {
///
/// The elements can be floats but no particular result is guaranteed
/// if an element is NaN.
#[cfg(feature = "use_std")]
#[cfg(feature = "use_alloc")]
fn min_set(self) -> Vec<Self::Item>
where
Self: Sized,
Expand Down Expand Up @@ -3204,7 +3202,7 @@ pub trait Itertools: Iterator {
///
/// The elements can be floats but no particular result is guaranteed
/// if an element is NaN.
#[cfg(feature = "use_std")]
#[cfg(feature = "use_alloc")]
fn min_set_by<F>(self, mut compare: F) -> Vec<Self::Item>
where
Self: Sized,
Expand Down Expand Up @@ -3236,7 +3234,7 @@ pub trait Itertools: Iterator {
///
/// The elements can be floats but no particular result is guaranteed
/// if an element is NaN.
#[cfg(feature = "use_std")]
#[cfg(feature = "use_alloc")]
fn min_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
where
Self: Sized,
Expand Down Expand Up @@ -3268,7 +3266,7 @@ pub trait Itertools: Iterator {
///
/// The elements can be floats but no particular result is guaranteed
/// if an element is NaN.
#[cfg(feature = "use_std")]
#[cfg(feature = "use_alloc")]
fn max_set(self) -> Vec<Self::Item>
where
Self: Sized,
Expand Down Expand Up @@ -3301,7 +3299,7 @@ pub trait Itertools: Iterator {
///
/// The elements can be floats but no particular result is guaranteed
/// if an element is NaN.
#[cfg(feature = "use_std")]
#[cfg(feature = "use_alloc")]
fn max_set_by<F>(self, mut compare: F) -> Vec<Self::Item>
where
Self: Sized,
Expand Down Expand Up @@ -3333,7 +3331,7 @@ pub trait Itertools: Iterator {
///
/// The elements can be floats but no particular result is guaranteed
/// if an element is NaN.
#[cfg(feature = "use_std")]
#[cfg(feature = "use_alloc")]
fn max_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
where
Self: Sized,
Expand Down
1 change: 1 addition & 0 deletions src/size_hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub fn add_scalar(sh: SizeHint, x: usize) -> SizeHint {
}

/// Subtract `x` correctly from a `SizeHint`.
#[cfg(feature = "use_alloc")]
#[inline]
pub fn sub_scalar(sh: SizeHint, x: usize) -> SizeHint {
let (mut low, mut hi) = sh;
Expand Down
2 changes: 1 addition & 1 deletion src/tuple_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ where
// not yet produced as a tuple.
let buffered = T::buffer_len(&self.buf);
// To that, we must add the size estimates of the underlying iterator.
let (mut unbuffered_lo, mut unbuffered_hi) = self.iter.size_hint();
let (unbuffered_lo, unbuffered_hi) = self.iter.size_hint();
// The total low estimate is the sum of the already-buffered elements,
// plus the low estimate of remaining unbuffered elements, divided by
// the tuple size.
Expand Down
2 changes: 2 additions & 0 deletions tests/quick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//!
//! In particular we test the tedious size_hint and exact size correctness.
#![allow(deprecated, unstable_name_collisions)]

use itertools::free::{
cloned, enumerate, multipeek, peek_nth, put_back, put_back_n, rciter, zip, zip_eq,
};
Expand Down
2 changes: 2 additions & 0 deletions tests/specializations.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unstable_name_collisions)]

use itertools::Itertools;
use quickcheck::quickcheck;
use std::fmt::Debug;
Expand Down
1 change: 1 addition & 0 deletions tests/test_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//! option. This file may not be copied, modified, or distributed
//! except according to those terms.
#![no_std]
#![allow(deprecated)]

use crate::it::chain;
use crate::it::free::put_back;
Expand Down
2 changes: 2 additions & 0 deletions tests/test_std.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unstable_name_collisions)]

use crate::it::cloned;
use crate::it::free::put_back_n;
use crate::it::free::rciter;
Expand Down

0 comments on commit 3e5395d

Please sign in to comment.