1
Fork 0

Fix the fmt issues

This commit is contained in:
Clément Renault 2020-12-10 19:10:09 +01:00
parent 45693b43a5
commit 7952ea5a04
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
3 changed files with 20 additions and 21 deletions

View file

@ -110,6 +110,8 @@ pub use core::slice::{Chunks, Windows};
pub use core::slice::{ChunksExact, ChunksExactMut}; pub use core::slice::{ChunksExact, ChunksExactMut};
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub use core::slice::{ChunksMut, Split, SplitMut}; pub use core::slice::{ChunksMut, Split, SplitMut};
#[unstable(feature = "slice_group_by", issue = "none")]
pub use core::slice::{GroupBy, GroupByMut};
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub use core::slice::{Iter, IterMut}; pub use core::slice::{Iter, IterMut};
#[stable(feature = "rchunks", since = "1.31.0")] #[stable(feature = "rchunks", since = "1.31.0")]
@ -118,8 +120,6 @@ pub use core::slice::{RChunks, RChunksExact, RChunksExactMut, RChunksMut};
pub use core::slice::{RSplit, RSplitMut}; pub use core::slice::{RSplit, RSplitMut};
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub use core::slice::{RSplitN, RSplitNMut, SplitN, SplitNMut}; pub use core::slice::{RSplitN, RSplitNMut, SplitN, SplitNMut};
#[unstable(feature = "slice_group_by", issue = "none")]
pub use core::slice::{GroupBy, GroupByMut};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Basic slice extension methods // Basic slice extension methods

View file

@ -2991,7 +2991,8 @@ impl<'a, T: 'a, P> GroupBy<'a, T, P> {
#[unstable(feature = "slice_group_by", issue = "none")] #[unstable(feature = "slice_group_by", issue = "none")]
impl<'a, T: 'a, P> Iterator for GroupBy<'a, T, P> impl<'a, T: 'a, P> Iterator for GroupBy<'a, T, P>
where P: FnMut(&T, &T) -> bool, where
P: FnMut(&T, &T) -> bool,
{ {
type Item = &'a [T]; type Item = &'a [T];
@ -3013,11 +3014,7 @@ where P: FnMut(&T, &T) -> bool,
#[inline] #[inline]
fn size_hint(&self) -> (usize, Option<usize>) { fn size_hint(&self) -> (usize, Option<usize>) {
if self.slice.is_empty() { if self.slice.is_empty() { (0, Some(0)) } else { (1, Some(self.slice.len())) }
(0, Some(0))
} else {
(1, Some(self.slice.len()))
}
} }
#[inline] #[inline]
@ -3028,7 +3025,8 @@ where P: FnMut(&T, &T) -> bool,
#[unstable(feature = "slice_group_by", issue = "none")] #[unstable(feature = "slice_group_by", issue = "none")]
impl<'a, T: 'a, P> DoubleEndedIterator for GroupBy<'a, T, P> impl<'a, T: 'a, P> DoubleEndedIterator for GroupBy<'a, T, P>
where P: FnMut(&T, &T) -> bool, where
P: FnMut(&T, &T) -> bool,
{ {
#[inline] #[inline]
fn next_back(&mut self) -> Option<Self::Item> { fn next_back(&mut self) -> Option<Self::Item> {
@ -3048,9 +3046,7 @@ where P: FnMut(&T, &T) -> bool,
} }
#[unstable(feature = "slice_group_by", issue = "none")] #[unstable(feature = "slice_group_by", issue = "none")]
impl<'a, T: 'a, P> FusedIterator for GroupBy<'a, T, P> impl<'a, T: 'a, P> FusedIterator for GroupBy<'a, T, P> where P: FnMut(&T, &T) -> bool {}
where P: FnMut(&T, &T) -> bool,
{ }
/// An iterator over slice in (non-overlapping) mutable chunks separated /// An iterator over slice in (non-overlapping) mutable chunks separated
/// by a predicate. /// by a predicate.
@ -3075,7 +3071,8 @@ impl<'a, T: 'a, P> GroupByMut<'a, T, P> {
#[unstable(feature = "slice_group_by", issue = "none")] #[unstable(feature = "slice_group_by", issue = "none")]
impl<'a, T: 'a, P> Iterator for GroupByMut<'a, T, P> impl<'a, T: 'a, P> Iterator for GroupByMut<'a, T, P>
where P: FnMut(&T, &T) -> bool, where
P: FnMut(&T, &T) -> bool,
{ {
type Item = &'a mut [T]; type Item = &'a mut [T];
@ -3098,11 +3095,7 @@ where P: FnMut(&T, &T) -> bool,
#[inline] #[inline]
fn size_hint(&self) -> (usize, Option<usize>) { fn size_hint(&self) -> (usize, Option<usize>) {
if self.slice.is_empty() { if self.slice.is_empty() { (0, Some(0)) } else { (1, Some(self.slice.len())) }
(0, Some(0))
} else {
(1, Some(self.slice.len()))
}
} }
#[inline] #[inline]
@ -3113,7 +3106,8 @@ where P: FnMut(&T, &T) -> bool,
#[unstable(feature = "slice_group_by", issue = "none")] #[unstable(feature = "slice_group_by", issue = "none")]
impl<'a, T: 'a, P> DoubleEndedIterator for GroupByMut<'a, T, P> impl<'a, T: 'a, P> DoubleEndedIterator for GroupByMut<'a, T, P>
where P: FnMut(&T, &T) -> bool, where
P: FnMut(&T, &T) -> bool,
{ {
#[inline] #[inline]
fn next_back(&mut self) -> Option<Self::Item> { fn next_back(&mut self) -> Option<Self::Item> {
@ -3132,3 +3126,6 @@ where P: FnMut(&T, &T) -> bool,
} }
} }
} }
#[unstable(feature = "slice_group_by", issue = "none")]
impl<'a, T: 'a, P> FusedIterator for GroupByMut<'a, T, P> where P: FnMut(&T, &T) -> bool {}

View file

@ -1234,7 +1234,8 @@ impl<T> [T] {
#[unstable(feature = "slice_group_by", issue = "none")] #[unstable(feature = "slice_group_by", issue = "none")]
#[inline] #[inline]
pub fn group_by<F>(&self, pred: F) -> GroupBy<'_, T, F> pub fn group_by<F>(&self, pred: F) -> GroupBy<'_, T, F>
where F: FnMut(&T, &T) -> bool where
F: FnMut(&T, &T) -> bool,
{ {
GroupBy::new(self, pred) GroupBy::new(self, pred)
} }
@ -1263,7 +1264,8 @@ impl<T> [T] {
#[unstable(feature = "slice_group_by", issue = "none")] #[unstable(feature = "slice_group_by", issue = "none")]
#[inline] #[inline]
pub fn group_by_mut<F>(&mut self, pred: F) -> GroupByMut<'_, T, F> pub fn group_by_mut<F>(&mut self, pred: F) -> GroupByMut<'_, T, F>
where F: FnMut(&T, &T) -> bool where
F: FnMut(&T, &T) -> bool,
{ {
GroupByMut::new(self, pred) GroupByMut::new(self, pred)
} }