Skip to content

Commit ea2fe00

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 161600 b: refs/heads/snap-stage3 c: f2af07e h: refs/heads/master v: v3
1 parent 42f0733 commit ea2fe00

File tree

109 files changed

+403
-795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+403
-795
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4eb72d268f337a8f117c86a2ac1b98336cab9e9d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 8bca470c5acf13aa20022a2c462a89f72de721fc
4+
refs/heads/snap-stage3: f2af07e6d5254ca7b2bb5791afe5314fe6947128
55
refs/heads/try: 0f0d21c1eb5c7be04d323e0b06faf252ad790af6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/doc/reference.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ An example of `use` declarations:
994994

995995
```
996996
use std::iter::range_step;
997-
use std::option::Option::{Some, None};
997+
use std::option::{Some, None};
998998
use std::collections::hash_map::{mod, HashMap};
999999
10001000
fn foo<T>(_: T){}
@@ -1004,8 +1004,8 @@ fn main() {
10041004
// Equivalent to 'std::iter::range_step(0u, 10u, 2u);'
10051005
range_step(0u, 10u, 2u);
10061006
1007-
// Equivalent to 'foo(vec![std::option::Option::Some(1.0f64),
1008-
// std::option::Option::None]);'
1007+
// Equivalent to 'foo(vec![std::option::Some(1.0f64),
1008+
// std::option::None]);'
10091009
foo(vec![Some(1.0f64), None]);
10101010
10111011
// Both `hash_map` and `HashMap` are in scope.

branches/snap-stage3/src/etc/unicode.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def escape_char(c):
292292
def emit_bsearch_range_table(f):
293293
f.write("""
294294
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
295-
use core::cmp::Ordering::{Equal, Less, Greater};
295+
use core::cmp::{Equal, Less, Greater};
296296
use core::slice::SlicePrelude;
297297
r.binary_search(|&(lo,hi)| {
298298
if lo <= c && c <= hi { Equal }
@@ -350,11 +350,10 @@ def emit_regex_module(f, cats, w_data):
350350
def emit_conversions_module(f, lowerupper, upperlower):
351351
f.write("pub mod conversions {")
352352
f.write("""
353-
use core::cmp::Ordering::{Equal, Less, Greater};
353+
use core::cmp::{Equal, Less, Greater};
354354
use core::slice::SlicePrelude;
355355
use core::tuple::Tuple2;
356-
use core::option::Option;
357-
use core::option::Option::{Some, None};
356+
use core::option::{Option, Some, None};
358357
use core::slice;
359358
360359
pub fn to_lower(c: char) -> char {
@@ -404,7 +403,7 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
404403
f.write(""" }
405404
406405
fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
407-
use core::cmp::Ordering::{Equal, Less, Greater};
406+
use core::cmp::{Equal, Less, Greater};
408407
match r.binary_search(|&(lo, hi, _)| {
409408
if lo <= c && c <= hi { Equal }
410409
else if hi < c { Less }
@@ -431,13 +430,12 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
431430

432431
def emit_charwidth_module(f, width_table):
433432
f.write("pub mod charwidth {\n")
434-
f.write(" use core::option::Option;\n")
435-
f.write(" use core::option::Option::{Some, None};\n")
433+
f.write(" use core::option::{Option, Some, None};\n")
436434
f.write(" use core::slice::SlicePrelude;\n")
437435
f.write(" use core::slice;\n")
438436
f.write("""
439437
fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 {
440-
use core::cmp::Ordering::{Equal, Less, Greater};
438+
use core::cmp::{Equal, Less, Greater};
441439
match r.binary_search(|&(lo, hi, _, _)| {
442440
if lo <= c && c <= hi { Equal }
443441
else if hi < c { Less }
@@ -532,7 +530,7 @@ def comp_pfun(char):
532530

533531
f.write("""
534532
fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 {
535-
use core::cmp::Ordering::{Equal, Less, Greater};
533+
use core::cmp::{Equal, Less, Greater};
536534
use core::slice::SlicePrelude;
537535
use core::slice;
538536
match r.binary_search(|&(lo, hi, _)| {

branches/snap-stage3/src/liballoc/arc.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ use core::kinds::{Sync, Send};
2222
use core::mem::{min_align_of, size_of, drop};
2323
use core::mem;
2424
use core::ops::{Drop, Deref};
25-
use core::option::Option;
26-
use core::option::Option::{Some, None};
25+
use core::option::{Some, None, Option};
2726
use core::ptr::RawPtr;
2827
use core::ptr;
2928
use heap::deallocate;
@@ -327,8 +326,7 @@ mod tests {
327326
use std::comm::channel;
328327
use std::mem::drop;
329328
use std::ops::Drop;
330-
use std::option::Option;
331-
use std::option::Option::{Some, None};
329+
use std::option::{Option, Some, None};
332330
use std::str::Str;
333331
use std::sync::atomic;
334332
use std::task;

branches/snap-stage3/src/liballoc/boxed.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ use core::kinds::Sized;
1919
use core::mem;
2020
use core::option::Option;
2121
use core::raw::TraitObject;
22-
use core::result::Result;
23-
use core::result::Result::{Ok, Err};
22+
use core::result::{Ok, Err, Result};
2423

2524
/// A value that represents the global exchange heap. This is the default
2625
/// place that the `box` keyword allocates into when no place is supplied.

branches/snap-stage3/src/liballoc/heap.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ mod imp {
177177

178178
#[cfg(all(not(external_funcs), not(external_crate), jemalloc))]
179179
mod imp {
180-
use core::option::Option;
181-
use core::option::Option::None;
180+
use core::option::{None, Option};
182181
use core::ptr::{null_mut, null};
183182
use core::num::Int;
184183
use libc::{c_char, c_int, c_void, size_t};

branches/snap-stage3/src/liballoc/rc.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,10 @@ use core::fmt;
149149
use core::kinds::marker;
150150
use core::mem::{transmute, min_align_of, size_of, forget};
151151
use core::ops::{Deref, Drop};
152-
use core::option::Option;
153-
use core::option::Option::{Some, None};
152+
use core::option::{Option, Some, None};
154153
use core::ptr;
155154
use core::ptr::RawPtr;
156-
use core::result::Result;
157-
use core::result::Result::{Ok, Err};
155+
use core::result::{Result, Ok, Err};
158156

159157
use heap::deallocate;
160158

@@ -741,9 +739,8 @@ impl<T> RcBoxPtr<T> for Weak<T> {
741739
mod tests {
742740
use super::{Rc, Weak, weak_count, strong_count};
743741
use std::cell::RefCell;
744-
use std::option::Option;
745-
use std::option::Option::{Some, None};
746-
use std::result::Result::{Err, Ok};
742+
use std::option::{Option, Some, None};
743+
use std::result::{Err, Ok};
747744
use std::mem::drop;
748745
use std::clone::Clone;
749746

branches/snap-stage3/src/libcollections/binary_heap.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,8 @@ mod tests {
769769
v.sort();
770770
data.sort();
771771

772-
assert_eq!(v.as_slice(), data.as_slice());
773-
assert_eq!(heap.into_sorted_vec().as_slice(), data.as_slice());
772+
assert_eq!(v, data);
773+
assert_eq!(heap.into_sorted_vec(), data);
774774
}
775775

776776
#[test]
@@ -812,7 +812,7 @@ mod tests {
812812
fn test_from_iter() {
813813
let xs = vec!(9u, 8, 7, 6, 5, 4, 3, 2, 1);
814814

815-
let mut q: BinaryHeap<uint> = xs.as_slice().iter().rev().map(|&x| x).collect();
815+
let mut q: BinaryHeap<uint> = xs.iter().rev().map(|&x| x).collect();
816816

817817
for &x in xs.iter() {
818818
assert_eq!(q.pop().unwrap(), x);

branches/snap-stage3/src/libcollections/bit.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,10 +1692,10 @@ mod tests {
16921692
#[test]
16931693
fn test_to_str() {
16941694
let zerolen = Bitv::new();
1695-
assert_eq!(zerolen.to_string().as_slice(), "");
1695+
assert_eq!(zerolen.to_string(), "");
16961696

16971697
let eightbits = Bitv::with_capacity(8u, false);
1698-
assert_eq!(eightbits.to_string().as_slice(), "00000000")
1698+
assert_eq!(eightbits.to_string(), "00000000")
16991699
}
17001700

17011701
#[test]
@@ -1718,7 +1718,7 @@ mod tests {
17181718
let mut b = bitv::Bitv::with_capacity(2, false);
17191719
b.set(0, true);
17201720
b.set(1, false);
1721-
assert_eq!(b.to_string().as_slice(), "10");
1721+
assert_eq!(b.to_string(), "10");
17221722
}
17231723

17241724
#[test]
@@ -2029,7 +2029,7 @@ mod tests {
20292029
fn test_from_bytes() {
20302030
let bitv = from_bytes(&[0b10110110, 0b00000000, 0b11111111]);
20312031
let str = format!("{}{}{}", "10110110", "00000000", "11111111");
2032-
assert_eq!(bitv.to_string().as_slice(), str.as_slice());
2032+
assert_eq!(bitv.to_string(), str);
20332033
}
20342034

20352035
#[test]
@@ -2048,7 +2048,7 @@ mod tests {
20482048
fn test_from_bools() {
20492049
let bools = vec![true, false, true, true];
20502050
let bitv: Bitv = bools.iter().map(|n| *n).collect();
2051-
assert_eq!(bitv.to_string().as_slice(), "1011");
2051+
assert_eq!(bitv.to_string(), "1011");
20522052
}
20532053

20542054
#[test]
@@ -2207,7 +2207,7 @@ mod tests {
22072207

22082208
let expected = [3, 5, 11, 77];
22092209
let actual = a.intersection(&b).collect::<Vec<uint>>();
2210-
assert_eq!(actual.as_slice(), expected.as_slice());
2210+
assert_eq!(actual, expected);
22112211
}
22122212

22132213
#[test]
@@ -2226,7 +2226,7 @@ mod tests {
22262226

22272227
let expected = [1, 5, 500];
22282228
let actual = a.difference(&b).collect::<Vec<uint>>();
2229-
assert_eq!(actual.as_slice(), expected.as_slice());
2229+
assert_eq!(actual, expected);
22302230
}
22312231

22322232
#[test]
@@ -2247,7 +2247,7 @@ mod tests {
22472247

22482248
let expected = [1, 5, 11, 14, 220];
22492249
let actual = a.symmetric_difference(&b).collect::<Vec<uint>>();
2250-
assert_eq!(actual.as_slice(), expected.as_slice());
2250+
assert_eq!(actual, expected);
22512251
}
22522252

22532253
#[test]
@@ -2272,7 +2272,7 @@ mod tests {
22722272

22732273
let expected = [1, 3, 5, 9, 11, 13, 19, 24, 160, 200];
22742274
let actual = a.union(&b).collect::<Vec<uint>>();
2275-
assert_eq!(actual.as_slice(), expected.as_slice());
2275+
assert_eq!(actual, expected);
22762276
}
22772277

22782278
#[test]

branches/snap-stage3/src/libcollections/btree/node.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,22 +169,22 @@ impl <K, V> Node<K, V> {
169169

170170
/// Get the node's value at the given index
171171
pub fn val(&self, index: uint) -> Option<&V> {
172-
self.vals.as_slice().get(index)
172+
self.vals.get(index)
173173
}
174174

175175
/// Get the node's value at the given index
176176
pub fn val_mut(&mut self, index: uint) -> Option<&mut V> {
177-
self.vals.as_mut_slice().get_mut(index)
177+
self.vals.get_mut(index)
178178
}
179179

180180
/// Get the node's value mutably without any bounds checks.
181181
pub unsafe fn unsafe_val_mut(&mut self, index: uint) -> &mut V {
182-
self.vals.as_mut_slice().unsafe_mut(index)
182+
self.vals.unsafe_mut(index)
183183
}
184184

185185
/// Get the node's edge at the given index
186186
pub fn edge(&self, index: uint) -> Option<&Node<K,V>> {
187-
self.edges.as_slice().get(index)
187+
self.edges.get(index)
188188
}
189189

190190
/// Get the node's edge mutably at the given index
@@ -281,8 +281,8 @@ impl <K, V> Node<K, V> {
281281
pub fn iter<'a>(&'a self) -> Traversal<'a, K, V> {
282282
let is_leaf = self.is_leaf();
283283
Traversal {
284-
elems: self.keys.as_slice().iter().zip(self.vals.as_slice().iter()),
285-
edges: self.edges.as_slice().iter(),
284+
elems: self.keys.iter().zip(self.vals.iter()),
285+
edges: self.edges.iter(),
286286
head_is_edge: true,
287287
tail_is_edge: true,
288288
has_edges: !is_leaf,
@@ -292,7 +292,7 @@ impl <K, V> Node<K, V> {
292292
pub fn iter_mut<'a>(&'a mut self) -> MutTraversal<'a, K, V> {
293293
let is_leaf = self.is_leaf();
294294
MutTraversal {
295-
elems: self.keys.as_slice().iter().zip(self.vals.as_mut_slice().iter_mut()),
295+
elems: self.keys.iter().zip(self.vals.as_mut_slice().iter_mut()),
296296
edges: self.edges.as_mut_slice().iter_mut(),
297297
head_is_edge: true,
298298
tail_is_edge: true,
@@ -477,7 +477,7 @@ fn split<T>(left: &mut Vec<T>) -> Vec<T> {
477477
let left_len = len - right_len;
478478
let mut right = Vec::with_capacity(left.capacity());
479479
unsafe {
480-
let left_ptr = left.as_slice().unsafe_get(left_len) as *const _;
480+
let left_ptr = left.unsafe_get(left_len) as *const _;
481481
let right_ptr = right.as_mut_slice().as_mut_ptr();
482482
ptr::copy_nonoverlapping_memory(right_ptr, left_ptr, right_len);
483483
left.set_len(left_len);

branches/snap-stage3/src/libcollections/btree/set.rs

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -94,92 +94,26 @@ impl<T> BTreeSet<T> {
9494

9595
impl<T: Ord> BTreeSet<T> {
9696
/// Visits the values representing the difference, in ascending order.
97-
///
98-
/// # Example
99-
///
100-
/// ```
101-
/// use std::collections::BTreeSet;
102-
///
103-
/// let mut a = BTreeSet::new();
104-
/// a.insert(1u);
105-
/// a.insert(2u);
106-
///
107-
/// let mut b = BTreeSet::new();
108-
/// b.insert(2u);
109-
/// b.insert(3u);
110-
///
111-
/// let diff: Vec<uint> = a.difference(&b).cloned().collect();
112-
/// assert_eq!(diff, vec![1u]);
113-
/// ```
11497
#[unstable = "matches collection reform specification, waiting for dust to settle"]
11598
pub fn difference<'a>(&'a self, other: &'a BTreeSet<T>) -> DifferenceItems<'a, T> {
11699
DifferenceItems{a: self.iter().peekable(), b: other.iter().peekable()}
117100
}
118101

119102
/// Visits the values representing the symmetric difference, in ascending order.
120-
///
121-
/// # Example
122-
///
123-
/// ```
124-
/// use std::collections::BTreeSet;
125-
///
126-
/// let mut a = BTreeSet::new();
127-
/// a.insert(1u);
128-
/// a.insert(2u);
129-
///
130-
/// let mut b = BTreeSet::new();
131-
/// b.insert(2u);
132-
/// b.insert(3u);
133-
///
134-
/// let sym_diff: Vec<uint> = a.symmetric_difference(&b).cloned().collect();
135-
/// assert_eq!(sym_diff, vec![1u,3]);
136-
/// ```
137103
#[unstable = "matches collection reform specification, waiting for dust to settle"]
138104
pub fn symmetric_difference<'a>(&'a self, other: &'a BTreeSet<T>)
139105
-> SymDifferenceItems<'a, T> {
140106
SymDifferenceItems{a: self.iter().peekable(), b: other.iter().peekable()}
141107
}
142108

143109
/// Visits the values representing the intersection, in ascending order.
144-
///
145-
/// # Example
146-
///
147-
/// ```
148-
/// use std::collections::BTreeSet;
149-
///
150-
/// let mut a = BTreeSet::new();
151-
/// a.insert(1u);
152-
/// a.insert(2u);
153-
///
154-
/// let mut b = BTreeSet::new();
155-
/// b.insert(2u);
156-
/// b.insert(3u);
157-
///
158-
/// let intersection: Vec<uint> = a.intersection(&b).cloned().collect();
159-
/// assert_eq!(intersection, vec![2u]);
160-
/// ```
161110
#[unstable = "matches collection reform specification, waiting for dust to settle"]
162111
pub fn intersection<'a>(&'a self, other: &'a BTreeSet<T>)
163112
-> IntersectionItems<'a, T> {
164113
IntersectionItems{a: self.iter().peekable(), b: other.iter().peekable()}
165114
}
166115

167116
/// Visits the values representing the union, in ascending order.
168-
///
169-
/// # Example
170-
///
171-
/// ```
172-
/// use std::collections::BTreeSet;
173-
///
174-
/// let mut a = BTreeSet::new();
175-
/// a.insert(1u);
176-
///
177-
/// let mut b = BTreeSet::new();
178-
/// b.insert(2u);
179-
///
180-
/// let union: Vec<uint> = a.union(&b).cloned().collect();
181-
/// assert_eq!(union, vec![1u,2]);
182-
/// ```
183117
#[unstable = "matches collection reform specification, waiting for dust to settle"]
184118
pub fn union<'a>(&'a self, other: &'a BTreeSet<T>) -> UnionItems<'a, T> {
185119
UnionItems{a: self.iter().peekable(), b: other.iter().peekable()}

0 commit comments

Comments
 (0)