Skip to content

Commit 279f725

Browse files
committed
---
yaml --- r: 51391 b: refs/heads/incoming c: c724dae h: refs/heads/master i: 51389: 90341c6 51387: 9f26034 51383: e691f63 51375: f71053c 51359: d52f3be 51327: dd0a654 v: v3
1 parent 8681f88 commit 279f725

File tree

5 files changed

+29
-30
lines changed

5 files changed

+29
-30
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 8eb2bab100b42f0ba751552d8eff00eb2134c55a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 4bd26481c4c91858c544981990efb2f48e5d3bbe
9+
refs/heads/incoming: c724dae7def417cd9aea8710d479b28155ed0f4f
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/option.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use ops::Add;
4646
use kinds::Copy;
4747
use util;
4848
use num::Zero;
49-
use iter::BaseIter;
49+
use iter::{BaseIter, MutableIter};
5050

5151
#[cfg(test)] use ptr;
5252
#[cfg(test)] use str;
@@ -323,6 +323,13 @@ impl<T> BaseIter<T> for Option<T> {
323323
}
324324
}
325325
326+
impl<T> MutableIter<T> for Option<T> {
327+
#[inline(always)]
328+
fn each_mut(&mut self, f: &fn(&'self mut T) -> bool) {
329+
match *self { None => (), Some(ref mut t) => { f(t); } }
330+
}
331+
}
332+
326333
pub impl<T> Option<T> {
327334
/// Returns true if the option equals `none`
328335
#[inline(always)]

branches/incoming/src/libstd/treemap.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pure fn lt<K: Ord + TotalOrd, V>(a: &TreeMap<K, V>,
7272
}
7373
};
7474

75-
return a_len < b_len;
75+
a_len < b_len
7676
}
7777

7878
impl<K: Ord + TotalOrd, V> Ord for TreeMap<K, V> {
@@ -694,22 +694,13 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
694694

695695
skew(save);
696696

697-
match save.right {
698-
Some(ref mut right) => {
697+
for save.right.each_mut |right| {
699698
skew(right);
700-
match right.right {
701-
Some(ref mut x) => { skew(x) },
702-
None => ()
703-
}
704-
}
705-
None => ()
699+
for right.right.each_mut |x| { skew(x) }
706700
}
707701

708702
split(save);
709-
match save.right {
710-
Some(ref mut x) => { split(x) },
711-
None => ()
712-
}
703+
for save.right.each_mut |x| { split(x) }
713704
}
714705

715706
return removed;
@@ -718,7 +709,7 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
718709
}
719710

720711
*node = None;
721-
return true;
712+
true
722713
}
723714

724715
#[cfg(test)]

branches/incoming/src/libsyntax/codemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl cmp::Eq for span {
140140

141141
impl<S:Encoder> Encodable<S> for span {
142142
/* Note #1972 -- spans are encoded but not decoded */
143-
fn encode(&self, _s: &S) { _s.emit_nil() }
143+
fn encode(&self, _s: &S) { }
144144
}
145145

146146
impl<D:Decoder> Decodable<D> for span {

branches/incoming/src/libsyntax/parse/mod.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,10 @@ mod test {
297297
use std;
298298
use core::io;
299299
use core::option::None;
300+
use core::str;
300301
use util::testing::*;
301302

302-
#[test] fn to_json_str<E : Encodable<std::json::Encoder>>(val: @E) -> ~str {
303+
#[test] fn to_json_str (val: @Encodable<std::json::Encoder>) -> ~str {
303304
do io::with_str_writer |writer| {
304305
val.encode(~std::json::Encoder(writer));
305306
}
@@ -311,18 +312,18 @@ mod test {
311312
@~"fn foo (x : int) { x; }",
312313
~[],
313314
new_parse_sess(None));
314-
check_equal(to_json_str(@tts),
315-
~"[[\"tt_tok\",[null,[\"IDENT\",[\"fn\",false]]]],\
316-
[\"tt_tok\",[null,[\"IDENT\",[\"foo\",false]]]],\
317-
[\"tt_delim\",[[[\"tt_tok\",[null,[\"LPAREN\",[]]]],\
318-
[\"tt_tok\",[null,[\"IDENT\",[\"x\",false]]]],\
319-
[\"tt_tok\",[null,[\"COLON\",[]]]],\
320-
[\"tt_tok\",[null,[\"IDENT\",[\"int\",false]]]],\
321-
[\"tt_tok\",[null,[\"RPAREN\",[]]]]]]],\
322-
[\"tt_delim\",[[[\"tt_tok\",[null,[\"LBRACE\",[]]]],\
323-
[\"tt_tok\",[null,[\"IDENT\",[\"x\",false]]]],\
324-
[\"tt_tok\",[null,[\"SEMI\",[]]]],\
325-
[\"tt_tok\",[null,[\"RBRACE\",[]]]]]]]]"
315+
check_equal(to_json_str(@tts as @Encodable<std::json::Encoder>),
316+
~"[[\"tt_tok\",[,[\"IDENT\",[\"fn\",false]]]],\
317+
[\"tt_tok\",[,[\"IDENT\",[\"foo\",false]]]],\
318+
[\"tt_delim\",[[[\"tt_tok\",[,[\"LPAREN\",[]]]],\
319+
[\"tt_tok\",[,[\"IDENT\",[\"x\",false]]]],\
320+
[\"tt_tok\",[,[\"COLON\",[]]]],\
321+
[\"tt_tok\",[,[\"IDENT\",[\"int\",false]]]],\
322+
[\"tt_tok\",[,[\"RPAREN\",[]]]]]]],\
323+
[\"tt_delim\",[[[\"tt_tok\",[,[\"LBRACE\",[]]]],\
324+
[\"tt_tok\",[,[\"IDENT\",[\"x\",false]]]],\
325+
[\"tt_tok\",[,[\"SEMI\",[]]]],\
326+
[\"tt_tok\",[,[\"RBRACE\",[]]]]]]]]"
326327
);
327328
let ast1 = new_parser_from_tts(new_parse_sess(None),~[],tts)
328329
.parse_item(~[]);

0 commit comments

Comments
 (0)