Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
57009ca
Identify missing item category in `impl`s
estebank Mar 25, 2017
c963d61
Simplify error output
estebank Mar 28, 2017
1e3bc5a
Allow using Vec::<T>::place_back for T: !Clone
nagisa Mar 29, 2017
3fa28cc
Add a note about overflow for fetch_add/fetch_sub
Mar 30, 2017
2946c41
More consistent wording
Mar 30, 2017
09ac56d
mark build::cfg::start_new_block as inline(never)
arielb1 Apr 2, 2017
29a6a9e
iter: Use underlying find/rfind for the same methods in Rev
bluss Apr 3, 2017
74f8ea2
iter: Simplification in rfind's provided implementation
bluss Apr 3, 2017
7b89bd7
Add ptr::offset_to
Amanieu Mar 31, 2017
8f31e19
Merge branch 'master' into issue-40006
estebank Apr 3, 2017
018c5c9
Make 'overlapping_inherent_impls' lint a hard error
topecongiro Apr 4, 2017
6132fb8
Replace magic number with readable sig constant
anatol Apr 4, 2017
09f42ee
Move 'overlapping_inherent_impls' test to ui
topecongiro Apr 4, 2017
db60b0b
Move 'coherence-overlapping-inherent-impl-trait' test to ui
topecongiro Apr 4, 2017
2e3f0d8
add [T]::rsplit() and rsplit_mut() #41020
jorendorff Apr 3, 2017
a45fedf
simplify implementation of [T]::splitn and friends #41020
jorendorff Apr 3, 2017
f07ebd6
Simplify HashMap Bucket interface
arthurprs Mar 15, 2017
56902fb
Fixes other targets rustlibs installation
Mar 13, 2017
1f70247
Add tracking issue for offset_to
Amanieu Apr 5, 2017
44bcd26
Reduce a table used for `Debug` impl of `str`.
lifthrasiir Mar 21, 2017
540fc2c
Rollup merge of #40479 - sezaru:master, r=alexcrichton
Apr 5, 2017
327b9be
Rollup merge of #40561 - arthurprs:hm-adapt2, r=pczarn
Apr 5, 2017
a182027
Rollup merge of #40709 - lifthrasiir:leaner-unicode-debug-str, r=alex…
Apr 5, 2017
cee0508
Rollup merge of #40815 - estebank:issue-40006, r=GuillaumeGomez
Apr 5, 2017
1fdcb79
Rollup merge of #40909 - nagisa:fix-vec-placement, r=alexcrichton
Apr 5, 2017
fc5ff66
Rollup merge of #40927 - stjepang:docs-atomic-overflow-note, r=alexcr…
Apr 5, 2017
9d07447
Rollup merge of #40943 - Amanieu:offset_to, r=alexcrichton
Apr 5, 2017
b712950
Rollup merge of #41015 - arielb1:new-block-stack, r=alexcrichton
Apr 5, 2017
5e410ba
Rollup merge of #41028 - bluss:rev-rfind, r=alexcrichton
Apr 5, 2017
a69fcfa
Rollup merge of #41052 - topecongiro:overlapping_inherent_impls, r=es…
Apr 5, 2017
fa0f102
Rollup merge of #41054 - anatol:master, r=alexcrichton
Apr 5, 2017
d8b6109
Rollup merge of #41065 - jorendorff:slice-rsplit-41020, r=alexcrichton
Apr 5, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplify implementation of [T]::splitn and friends #41020
  • Loading branch information
jorendorff committed Apr 4, 2017
commit a45fedfa384fba4f972c2af26adb9cf7a0522725
26 changes: 9 additions & 17 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,7 @@ impl<T> SliceExt for [T] {
SplitN {
inner: GenericSplitN {
iter: self.split(pred),
count: n,
invert: false
count: n
}
}
}
Expand All @@ -327,9 +326,8 @@ impl<T> SliceExt for [T] {
{
RSplitN {
inner: GenericSplitN {
iter: self.split(pred),
count: n,
invert: true
iter: self.rsplit(pred),
count: n
}
}
}
Expand Down Expand Up @@ -504,8 +502,7 @@ impl<T> SliceExt for [T] {
SplitNMut {
inner: GenericSplitN {
iter: self.split_mut(pred),
count: n,
invert: false
count: n
}
}
}
Expand All @@ -516,9 +513,8 @@ impl<T> SliceExt for [T] {
{
RSplitNMut {
inner: GenericSplitN {
iter: self.split_mut(pred),
count: n,
invert: true
iter: self.rsplit_mut(pred),
count: n
}
}
}
Expand Down Expand Up @@ -1881,7 +1877,6 @@ impl<'a, T, P> FusedIterator for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool
struct GenericSplitN<I> {
iter: I,
count: usize,
invert: bool
}

impl<T, I: SplitIter<Item=T>> Iterator for GenericSplitN<I> {
Expand All @@ -1892,10 +1887,7 @@ impl<T, I: SplitIter<Item=T>> Iterator for GenericSplitN<I> {
match self.count {
0 => None,
1 => { self.count -= 1; self.iter.finish() }
_ => {
self.count -= 1;
if self.invert {self.iter.next_back()} else {self.iter.next()}
}
_ => { self.count -= 1; self.iter.next() }
}
}

Expand Down Expand Up @@ -1937,7 +1929,7 @@ impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for SplitN<'a, T, P> where P: FnMut(&
/// [slices]: ../../std/primitive.slice.html
#[stable(feature = "rust1", since = "1.0.0")]
pub struct RSplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
inner: GenericSplitN<Split<'a, T, P>>
inner: GenericSplitN<RSplit<'a, T, P>>
}

#[stable(feature = "core_impl_debug", since = "1.9.0")]
Expand Down Expand Up @@ -1980,7 +1972,7 @@ impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for SplitNMut<'a, T, P> where P: FnMu
/// [slices]: ../../std/primitive.slice.html
#[stable(feature = "rust1", since = "1.0.0")]
pub struct RSplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
inner: GenericSplitN<SplitMut<'a, T, P>>
inner: GenericSplitN<RSplitMut<'a, T, P>>
}

#[stable(feature = "core_impl_debug", since = "1.9.0")]
Expand Down