Repository: rust-itertools/itertools (language: rust)

Issue:
Increase MSRV to 1.63
This will allow us to progress on https://github.com/rust-itertools/itertools/labels/const-generics, particularly #560. This entails:
- updating
  https://github.com/rust-itertools/itertools/blob/a0225ceee50cafe9e974699e1cbf7fa9a1dcf901/.github/workflows/ci.yml#L47
- updating 
  https://github.com/rust-itertools/itertools/blob/a0225ceee50cafe9e974699e1cbf7fa9a1dcf901/Cargo.toml#L19
- updating
  https://github.com/rust-itertools/itertools/blob/a0225ceee50cafe9e974699e1cbf7fa9a1dcf901/src/lib.rs#L49
- auditing for `allow`'d clippy lints that can now be fixed 
- auditing `TODO` comments that can now be fixed


Discussion / hints:
And update
https://github.com/rust-itertools/itertools/blob/a0225ceee50cafe9e974699e1cbf7fa9a1dcf901/src/lib.rs#L49
👍 to 1.63 here.  The more things can be `from_fn` instead of writing unsafe code here the better.

And anyone using 1.69 or greater -- probably nearly everyone, TBH -- will get a version with a bunch of [internal optimizations](https://github.com/rust-lang/rust/pull/107634) to how `map` and `from_fn` work.

@kinto-b That's something you might want to do.
The "big" part here is to `grep clippy` and see which lint(s) can be resolved, if any.

Fix patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index df6bf412c..4b8dcf189 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -44,7 +44,7 @@ jobs:
       - uses: dtolnay/rust-toolchain@master
         with:
           # Here, it does not trigger a PR from dependabot.
-          toolchain: 1.43.1
+          toolchain: 1.63.0
       - run: cargo no-dev-deps check
 
   test:
diff --git a/Cargo.toml b/Cargo.toml
index 7fb6a3980..800614657 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,7 @@ categories = ["algorithms", "rust-patterns", "no-std", "no-std::no-alloc"]
 edition = "2018"
 
 # When bumping, please resolve all `#[allow(clippy::*)]` that are newly resolvable.
-rust-version = "1.43.1"
+rust-version = "1.63.0"
 
 [lib]
 bench = false
diff --git a/benches/specializations.rs b/benches/specializations.rs
index 3a5d80326..e70323f8e 100644
--- a/benches/specializations.rs
+++ b/benches/specializations.rs
@@ -1,4 +1,4 @@
-#![allow(unstable_name_collisions, clippy::incompatible_msrv)]
+#![allow(unstable_name_collisions)]
 
 use criterion::black_box;
 use criterion::BenchmarkId;
diff --git a/src/adaptors/mod.rs b/src/adaptors/mod.rs
index 095b08918..d717e5408 100644
--- a/src/adaptors/mod.rs
+++ b/src/adaptors/mod.rs
@@ -1108,9 +1108,7 @@ where
 
     fn next(&mut self) -> Option<Self::Item> {
         let f = &mut self.f;
-        // TODO: once MSRV >= 1.62, use `then_some`.
-        self.iter
-            .find_map(|(count, val)| if f(val) { Some(count) } else { None })
+        self.iter.find_map(|(count, val)| f(val).then_some(count))
     }
 
     fn size_hint(&self) -> (usize, Option<usize>) {
@@ -1138,11 +1136,10 @@ where
 {
     fn next_back(&mut self) -> Option<Self::Item> {
         let f = &mut self.f;
-        // TODO: once MSRV >= 1.62, use `then_some`.
         self.iter
             .by_ref()
             .rev()
-            .find_map(|(count, val)| if f(val) { Some(count) } else { None })
+            .find_map(|(count, val)| f(val).then_some(count))
     }
 
     fn rfold<B, G>(self, init: B, mut func: G) -> B
diff --git a/src/combinations_with_replacement.rs b/src/combinations_with_replacement.rs
index f363f9ba2..c17e75250 100644
--- a/src/combinations_with_replacement.rs
+++ b/src/combinations_with_replacement.rs
@@ -73,11 +73,7 @@ where
             Some((increment_from, increment_value)) => {
                 // We need to update the rightmost non-max value
                 // and all those to the right
-                for i in &mut self.indices[increment_from..] {
-                    *i = increment_value;
-                }
-                // TODO: once MSRV >= 1.50, use `fill` instead:
-                // self.indices[increment_from..].fill(increment_value);
+                self.indices[increment_from..].fill(increment_value);
                 false
             }
             // Otherwise, we're done
diff --git a/src/concat_impl.rs b/src/concat_impl.rs
index ec7b91c60..dc80839ce 100644
--- a/src/concat_impl.rs
+++ b/src/concat_impl.rs
@@ -1,8 +1,6 @@
-use crate::Itertools;
-
 /// Combine all an iterator's elements into one element by using [`Extend`].
 ///
-/// [`IntoIterator`]-enabled version of [`Itertools::concat`].
+/// [`IntoIterator`]-enabled version of [`Itertools::concat`](crate::Itertools::concat).
 ///
 /// This combinator will extend the first item with each of the rest of the
 /// items of the iterator. If the iterator is empty, the default value of
@@ -19,10 +17,9 @@ where
     I: IntoIterator,
     I::Item: Extend<<<I as IntoIterator>::Item as IntoIterator>::Item> + IntoIterator + Default,
 {
-    #[allow(deprecated)] //TODO: once msrv hits 1.51. replace `fold1` with `reduce`
     iterable
         .into_iter()
-        .fold1(|mut a, b| {
+        .reduce(|mut a, b| {
             a.extend(b);
             a
         })
diff --git a/src/kmerge_impl.rs b/src/kmerge_impl.rs
index 0be3840a1..13c935b28 100644
--- a/src/kmerge_impl.rs
+++ b/src/kmerge_impl.rs
@@ -1,5 +1,4 @@
 use crate::size_hint;
-use crate::Itertools;
 
 use alloc::vec::Vec;
 use std::fmt;
@@ -128,7 +127,7 @@ impl<T, F: FnMut(&T, &T) -> bool> KMergePredicate<T> for F {
 /// Create an iterator that merges elements of the contained iterators using
 /// the ordering function.
 ///
-/// [`IntoIterator`] enabled version of [`Itertools::kmerge`].
+/// [`IntoIterator`] enabled version of [`Itertools::kmerge`](crate::Itertools::kmerge).
 ///
 /// ```
 /// use itertools::kmerge;
@@ -172,7 +171,7 @@ where
 
 /// Create an iterator that merges elements of the contained iterators.
 ///
-/// [`IntoIterator`] enabled version of [`Itertools::kmerge_by`].
+/// [`IntoIterator`] enabled version of [`Itertools::kmerge_by`](crate::Itertools::kmerge_by).
 pub fn kmerge_by<I, F>(
     iterable: I,
     mut less_than: F,
@@ -223,11 +222,10 @@ where
     }
 
     fn size_hint(&self) -> (usize, Option<usize>) {
-        #[allow(deprecated)] //TODO: once msrv hits 1.51. replace `fold1` with `reduce`
         self.heap
             .iter()
             .map(|i| i.size_hint())
-            .fold1(size_hint::add)
+            .reduce(size_hint::add)
             .unwrap_or((0, Some(0)))
     }
 }
diff --git a/src/lib.rs b/src/lib.rs
index 0e7e68fb8..b98e03f29 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -46,7 +46,7 @@
 //!
 //! ## Rust Version
 //!
-//! This version of itertools requires Rust 1.43.1 or later.
+//! This version of itertools requires Rust 1.63.0 or later.
 
 #[cfg(not(feature = "use_std"))]
 extern crate core as std;


Test patch:
diff --git a/tests/quick.rs b/tests/quick.rs
index 5b8fd6a21..12b6b9d5a 100644
--- a/tests/quick.rs
+++ b/tests/quick.rs
@@ -253,7 +253,6 @@ where
         let mut it = get_it();
 
         for _ in 0..(counts.len() - 1) {
-            #[allow(clippy::manual_assert)]
             if it.next().is_none() {
                 panic!("Iterator shouldn't be finished, may not be deterministic");
             }
@@ -1512,13 +1511,12 @@ quickcheck! {
                 acc + val
             });
 
-        // TODO: Swap `fold1` with stdlib's `reduce` when it's stabilized
         let group_map_lookup = a.iter()
             .map(|&b| b as u64)
             .map(|i| (i % modulo, i))
             .into_group_map()
             .into_iter()
-            .map(|(key, vals)| (key, vals.into_iter().fold1(|acc, val| acc + val).unwrap()))
+            .map(|(key, vals)| (key, vals.into_iter().reduce(|acc, val| acc + val).unwrap()))
             .collect::<HashMap<_,_>>();
         assert_eq!(lookup, group_map_lookup);