Skip to content

Commit 1a82e6a

Browse files
committed
---
yaml --- r: 165527 b: refs/heads/master c: db3989c h: refs/heads/master i: 165525: 52a5ce5 165523: da4200f 165519: 3aaf4bb v: v3
1 parent 29dd859 commit 1a82e6a

File tree

222 files changed

+4424
-4991
lines changed

Some content is hidden

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

222 files changed

+4424
-4991
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 55cf032f43c04e2c884589dd8737b9ac58fcab20
2+
refs/heads/master: db3989c3db26bc3b5d4d2fda20eb1bbe1d2296ed
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 658529467d9d69ac9e09cacf98a6d61d781c2c76
55
refs/heads/try: aee614fc4973262a5a68efc643026e2b1458d65b

trunk/src/compiletest/compiletest.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
152152
matches.opt_str("ratchet-metrics").map(|s| Path::new(s)),
153153
ratchet_noise_percent:
154154
matches.opt_str("ratchet-noise-percent")
155-
.and_then(|s| s.as_slice().parse::<f64>()),
155+
.and_then(|s| from_str::<f64>(s.as_slice())),
156156
runtool: matches.opt_str("runtool"),
157157
host_rustcflags: matches.opt_str("host-rustcflags"),
158158
target_rustcflags: matches.opt_str("target-rustcflags"),
@@ -190,7 +190,9 @@ pub fn log_config(config: &Config) {
190190
logv(c, format!("filter: {}",
191191
opt_str(&config.filter
192192
.as_ref()
193-
.map(|re| re.to_string()))));
193+
.map(|re| {
194+
re.to_string().into_string()
195+
}))));
194196
logv(c, format!("runtool: {}", opt_str(&config.runtool)));
195197
logv(c, format!("host-rustcflags: {}",
196198
opt_str(&config.host_rustcflags)));

trunk/src/compiletest/header.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ pub fn gdb_version_to_int(version_string: &str) -> int {
351351
panic!("{}", error_string);
352352
}
353353

354-
let major: int = components[0].parse().expect(error_string);
355-
let minor: int = components[1].parse().expect(error_string);
354+
let major: int = from_str(components[0]).expect(error_string);
355+
let minor: int = from_str(components[1]).expect(error_string);
356356

357357
return major * 1000 + minor;
358358
}
@@ -362,6 +362,6 @@ pub fn lldb_version_to_int(version_string: &str) -> int {
362362
"Encountered LLDB version string with unexpected format: {}",
363363
version_string);
364364
let error_string = error_string.as_slice();
365-
let major: int = version_string.parse().expect(error_string);
365+
let major: int = from_str(version_string).expect(error_string);
366366
return major;
367367
}

trunk/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ fn split_maybe_args(argstr: &Option<String>) -> Vec<String> {
13611361
s.as_slice()
13621362
.split(' ')
13631363
.filter_map(|s| {
1364-
if s.chars().all(|c| c.is_whitespace()) {
1364+
if s.is_whitespace() {
13651365
None
13661366
} else {
13671367
Some(s.to_string())

trunk/src/doc/guide.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,8 +1010,8 @@ in the original declaration.
10101010
Finally, because fields have names, we can access the field through dot
10111011
notation: `origin.x`.
10121012

1013-
The values in structs are immutable by default, like other bindings in Rust.
1014-
Use `mut` to make them mutable:
1013+
The values in structs are immutable, like other bindings in Rust. However, you
1014+
can use `mut` to make them mutable:
10151015

10161016
```{rust}
10171017
struct Point {
@@ -2257,10 +2257,10 @@ a function for that:
22572257
let input = io::stdin().read_line()
22582258
.ok()
22592259
.expect("Failed to read line");
2260-
let input_num: Option<uint> = input.parse();
2260+
let input_num: Option<uint> = from_str(input.as_slice());
22612261
```
22622262
2263-
The `parse` function takes in a `&str` value and converts it into something.
2263+
The `from_str` function takes in a `&str` value and converts it into something.
22642264
We tell it what kind of something with a type hint. Remember our type hint with
22652265
`random()`? It looked like this:
22662266
@@ -2279,8 +2279,8 @@ In this case, we say `x` is a `uint` explicitly, so Rust is able to properly
22792279
tell `random()` what to generate. In a similar fashion, both of these work:
22802280
22812281
```{rust,ignore}
2282-
let input_num = "5".parse::<uint>(); // input_num: Option<uint>
2283-
let input_num: Option<uint> = "5".parse(); // input_num: Option<uint>
2282+
let input_num = from_str::<uint>("5"); // input_num: Option<uint>
2283+
let input_num: Option<uint> = from_str("5"); // input_num: Option<uint>
22842284
```
22852285
22862286
Anyway, with us now converting our input to a number, our code looks like this:
@@ -2301,7 +2301,7 @@ fn main() {
23012301
let input = io::stdin().read_line()
23022302
.ok()
23032303
.expect("Failed to read line");
2304-
let input_num: Option<uint> = input.parse();
2304+
let input_num: Option<uint> = from_str(input.as_slice());
23052305

23062306
println!("You guessed: {}", input_num);
23072307

@@ -2350,7 +2350,7 @@ fn main() {
23502350
let input = io::stdin().read_line()
23512351
.ok()
23522352
.expect("Failed to read line");
2353-
let input_num: Option<uint> = input.parse();
2353+
let input_num: Option<uint> = from_str(input.as_slice());
23542354
23552355
let num = match input_num {
23562356
Some(num) => num,
@@ -2395,7 +2395,7 @@ Uh, what? But we did!
23952395
23962396
... actually, we didn't. See, when you get a line of input from `stdin()`,
23972397
you get all the input. Including the `\n` character from you pressing Enter.
2398-
Therefore, `parse()` sees the string `"5\n"` and says "nope, that's not a
2398+
Therefore, `from_str()` sees the string `"5\n"` and says "nope, that's not a
23992399
number; there's non-number stuff in there!" Luckily for us, `&str`s have an easy
24002400
method we can use defined on them: `trim()`. One small modification, and our
24012401
code looks like this:
@@ -2416,7 +2416,7 @@ fn main() {
24162416
let input = io::stdin().read_line()
24172417
.ok()
24182418
.expect("Failed to read line");
2419-
let input_num: Option<uint> = input.trim().parse();
2419+
let input_num: Option<uint> = from_str(input.as_slice().trim());
24202420
24212421
let num = match input_num {
24222422
Some(num) => num,
@@ -2491,7 +2491,7 @@ fn main() {
24912491
let input = io::stdin().read_line()
24922492
.ok()
24932493
.expect("Failed to read line");
2494-
let input_num: Option<uint> = input.trim().parse();
2494+
let input_num: Option<uint> = from_str(input.as_slice().trim());
24952495

24962496
let num = match input_num {
24972497
Some(num) => num,
@@ -2566,7 +2566,7 @@ fn main() {
25662566
let input = io::stdin().read_line()
25672567
.ok()
25682568
.expect("Failed to read line");
2569-
let input_num: Option<uint> = input.trim().parse();
2569+
let input_num: Option<uint> = from_str(input.as_slice().trim());
25702570
25712571
let num = match input_num {
25722572
Some(num) => num,
@@ -2621,7 +2621,7 @@ fn main() {
26212621
let input = io::stdin().read_line()
26222622
.ok()
26232623
.expect("Failed to read line");
2624-
let input_num: Option<uint> = input.trim().parse();
2624+
let input_num: Option<uint> = from_str(input.as_slice().trim());
26252625
26262626
let num = match input_num {
26272627
Some(num) => num,
@@ -2697,7 +2697,7 @@ fn main() {
26972697
let input = io::stdin().read_line()
26982698
.ok()
26992699
.expect("Failed to read line");
2700-
let input_num: Option<uint> = input.trim().parse();
2700+
let input_num: Option<uint> = from_str(input.as_slice().trim());
27012701
27022702
let num = match input_num {
27032703
Some(num) => num,

trunk/src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3177,7 +3177,7 @@ Some examples of call expressions:
31773177
# fn add(x: int, y: int) -> int { 0 }
31783178
31793179
let x: int = add(1, 2);
3180-
let pi: Option<f32> = "3.14".parse();
3180+
let pi: Option<f32> = from_str("3.14");
31813181
```
31823182

31833183
### Lambda expressions

trunk/src/libcollections/binary_heap.rs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,15 @@ impl<T: Ord> BinaryHeap<T> {
272272
/// use std::collections::BinaryHeap;
273273
///
274274
/// let mut heap = BinaryHeap::new();
275-
/// assert_eq!(heap.peek(), None);
275+
/// assert_eq!(heap.top(), None);
276276
///
277277
/// heap.push(1i);
278278
/// heap.push(5i);
279279
/// heap.push(2i);
280-
/// assert_eq!(heap.peek(), Some(&5i));
280+
/// assert_eq!(heap.top(), Some(&5i));
281281
///
282282
/// ```
283-
#[stable]
284-
pub fn peek(&self) -> Option<&T> {
283+
pub fn top(&self) -> Option<&T> {
285284
self.data.get(0)
286285
}
287286

@@ -389,7 +388,7 @@ impl<T: Ord> BinaryHeap<T> {
389388
/// heap.push(1i);
390389
///
391390
/// assert_eq!(heap.len(), 3);
392-
/// assert_eq!(heap.peek(), Some(&5i));
391+
/// assert_eq!(heap.top(), Some(&5i));
393392
/// ```
394393
#[unstable = "matches collection reform specification, waiting for dust to settle"]
395394
pub fn push(&mut self, item: T) {
@@ -413,7 +412,7 @@ impl<T: Ord> BinaryHeap<T> {
413412
/// assert_eq!(heap.push_pop(3i), 5);
414413
/// assert_eq!(heap.push_pop(9i), 9);
415414
/// assert_eq!(heap.len(), 2);
416-
/// assert_eq!(heap.peek(), Some(&3i));
415+
/// assert_eq!(heap.top(), Some(&3i));
417416
/// ```
418417
pub fn push_pop(&mut self, mut item: T) -> T {
419418
match self.data.get_mut(0) {
@@ -443,7 +442,7 @@ impl<T: Ord> BinaryHeap<T> {
443442
/// assert_eq!(heap.replace(1i), None);
444443
/// assert_eq!(heap.replace(3i), Some(1i));
445444
/// assert_eq!(heap.len(), 1);
446-
/// assert_eq!(heap.peek(), Some(&3i));
445+
/// assert_eq!(heap.top(), Some(&3i));
447446
/// ```
448447
pub fn replace(&mut self, mut item: T) -> Option<T> {
449448
if !self.is_empty() {
@@ -715,13 +714,13 @@ mod tests {
715714
}
716715

717716
#[test]
718-
fn test_peek_and_pop() {
717+
fn test_top_and_pop() {
719718
let data = vec!(2u, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1);
720719
let mut sorted = data.clone();
721720
sorted.sort();
722721
let mut heap = BinaryHeap::from_vec(data);
723722
while !heap.is_empty() {
724-
assert_eq!(heap.peek().unwrap(), sorted.last().unwrap());
723+
assert_eq!(heap.top().unwrap(), sorted.last().unwrap());
725724
assert_eq!(heap.pop().unwrap(), sorted.pop().unwrap());
726725
}
727726
}
@@ -730,44 +729,44 @@ mod tests {
730729
fn test_push() {
731730
let mut heap = BinaryHeap::from_vec(vec!(2i, 4, 9));
732731
assert_eq!(heap.len(), 3);
733-
assert!(*heap.peek().unwrap() == 9);
732+
assert!(*heap.top().unwrap() == 9);
734733
heap.push(11);
735734
assert_eq!(heap.len(), 4);
736-
assert!(*heap.peek().unwrap() == 11);
735+
assert!(*heap.top().unwrap() == 11);
737736
heap.push(5);
738737
assert_eq!(heap.len(), 5);
739-
assert!(*heap.peek().unwrap() == 11);
738+
assert!(*heap.top().unwrap() == 11);
740739
heap.push(27);
741740
assert_eq!(heap.len(), 6);
742-
assert!(*heap.peek().unwrap() == 27);
741+
assert!(*heap.top().unwrap() == 27);
743742
heap.push(3);
744743
assert_eq!(heap.len(), 7);
745-
assert!(*heap.peek().unwrap() == 27);
744+
assert!(*heap.top().unwrap() == 27);
746745
heap.push(103);
747746
assert_eq!(heap.len(), 8);
748-
assert!(*heap.peek().unwrap() == 103);
747+
assert!(*heap.top().unwrap() == 103);
749748
}
750749

751750
#[test]
752751
fn test_push_unique() {
753752
let mut heap = BinaryHeap::from_vec(vec!(box 2i, box 4, box 9));
754753
assert_eq!(heap.len(), 3);
755-
assert!(*heap.peek().unwrap() == box 9);
754+
assert!(*heap.top().unwrap() == box 9);
756755
heap.push(box 11);
757756
assert_eq!(heap.len(), 4);
758-
assert!(*heap.peek().unwrap() == box 11);
757+
assert!(*heap.top().unwrap() == box 11);
759758
heap.push(box 5);
760759
assert_eq!(heap.len(), 5);
761-
assert!(*heap.peek().unwrap() == box 11);
760+
assert!(*heap.top().unwrap() == box 11);
762761
heap.push(box 27);
763762
assert_eq!(heap.len(), 6);
764-
assert!(*heap.peek().unwrap() == box 27);
763+
assert!(*heap.top().unwrap() == box 27);
765764
heap.push(box 3);
766765
assert_eq!(heap.len(), 7);
767-
assert!(*heap.peek().unwrap() == box 27);
766+
assert!(*heap.top().unwrap() == box 27);
768767
heap.push(box 103);
769768
assert_eq!(heap.len(), 8);
770-
assert!(*heap.peek().unwrap() == box 103);
769+
assert!(*heap.top().unwrap() == box 103);
771770
}
772771

773772
#[test]
@@ -832,9 +831,9 @@ mod tests {
832831
}
833832

834833
#[test]
835-
fn test_empty_peek() {
834+
fn test_empty_top() {
836835
let empty = BinaryHeap::<int>::new();
837-
assert!(empty.peek().is_none());
836+
assert!(empty.top().is_none());
838837
}
839838

840839
#[test]

0 commit comments

Comments
 (0)