Skip to content

Commit 4663619

Browse files
committed
---
yaml --- r: 80730 b: refs/heads/try c: 38f97ea h: refs/heads/master v: v3
1 parent 200602f commit 4663619

File tree

26 files changed

+203
-162
lines changed

26 files changed

+203
-162
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cbd1eefbd350797b783df119fed7956d7e1c74ad
5-
refs/heads/try: e03d60e9ebf2dbc2d18ab9919f905c17b967fcde
5+
refs/heads/try: 38f97ea10313ba9a8c6f57fbf73ff8daf5376e8b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libextra/num/rational.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ impl<T: FromStr + Clone + Integer + Ord>
273273
return None
274274
}
275275
let a_option: Option<T> = FromStr::from_str(split[0]);
276-
do a_option.chain |a| {
276+
do a_option.and_then |a| {
277277
let b_option: Option<T> = FromStr::from_str(split[1]);
278-
do b_option.chain |b| {
278+
do b_option.and_then |b| {
279279
Some(Ratio::new(a.clone(), b.clone()))
280280
}
281281
}
@@ -291,10 +291,10 @@ impl<T: FromStrRadix + Clone + Integer + Ord>
291291
} else {
292292
let a_option: Option<T> = FromStrRadix::from_str_radix(split[0],
293293
radix);
294-
do a_option.chain |a| {
294+
do a_option.and_then |a| {
295295
let b_option: Option<T> =
296296
FromStrRadix::from_str_radix(split[1], radix);
297-
do b_option.chain |b| {
297+
do b_option.and_then |b| {
298298
Some(Ratio::new(a.clone(), b.clone()))
299299
}
300300
}

branches/try/src/libextra/time.rs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -442,21 +442,21 @@ fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
442442
},
443443
'c' => {
444444
parse_type(s, pos, 'a', &mut *tm)
445-
.chain(|pos| parse_char(s, pos, ' '))
446-
.chain(|pos| parse_type(s, pos, 'b', &mut *tm))
447-
.chain(|pos| parse_char(s, pos, ' '))
448-
.chain(|pos| parse_type(s, pos, 'e', &mut *tm))
449-
.chain(|pos| parse_char(s, pos, ' '))
450-
.chain(|pos| parse_type(s, pos, 'T', &mut *tm))
451-
.chain(|pos| parse_char(s, pos, ' '))
452-
.chain(|pos| parse_type(s, pos, 'Y', &mut *tm))
445+
.and_then(|pos| parse_char(s, pos, ' '))
446+
.and_then(|pos| parse_type(s, pos, 'b', &mut *tm))
447+
.and_then(|pos| parse_char(s, pos, ' '))
448+
.and_then(|pos| parse_type(s, pos, 'e', &mut *tm))
449+
.and_then(|pos| parse_char(s, pos, ' '))
450+
.and_then(|pos| parse_type(s, pos, 'T', &mut *tm))
451+
.and_then(|pos| parse_char(s, pos, ' '))
452+
.and_then(|pos| parse_type(s, pos, 'Y', &mut *tm))
453453
}
454454
'D' | 'x' => {
455455
parse_type(s, pos, 'm', &mut *tm)
456-
.chain(|pos| parse_char(s, pos, '/'))
457-
.chain(|pos| parse_type(s, pos, 'd', &mut *tm))
458-
.chain(|pos| parse_char(s, pos, '/'))
459-
.chain(|pos| parse_type(s, pos, 'y', &mut *tm))
456+
.and_then(|pos| parse_char(s, pos, '/'))
457+
.and_then(|pos| parse_type(s, pos, 'd', &mut *tm))
458+
.and_then(|pos| parse_char(s, pos, '/'))
459+
.and_then(|pos| parse_type(s, pos, 'y', &mut *tm))
460460
}
461461
'd' => match match_digits_in_range(s, pos, 2u, false, 1_i32,
462462
31_i32) {
@@ -475,10 +475,10 @@ fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
475475
}
476476
'F' => {
477477
parse_type(s, pos, 'Y', &mut *tm)
478-
.chain(|pos| parse_char(s, pos, '-'))
479-
.chain(|pos| parse_type(s, pos, 'm', &mut *tm))
480-
.chain(|pos| parse_char(s, pos, '-'))
481-
.chain(|pos| parse_type(s, pos, 'd', &mut *tm))
478+
.and_then(|pos| parse_char(s, pos, '-'))
479+
.and_then(|pos| parse_type(s, pos, 'm', &mut *tm))
480+
.and_then(|pos| parse_char(s, pos, '-'))
481+
.and_then(|pos| parse_type(s, pos, 'd', &mut *tm))
482482
}
483483
'H' => {
484484
match match_digits_in_range(s, pos, 2u, false, 0_i32, 23_i32) {
@@ -553,17 +553,17 @@ fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
553553
},
554554
'R' => {
555555
parse_type(s, pos, 'H', &mut *tm)
556-
.chain(|pos| parse_char(s, pos, ':'))
557-
.chain(|pos| parse_type(s, pos, 'M', &mut *tm))
556+
.and_then(|pos| parse_char(s, pos, ':'))
557+
.and_then(|pos| parse_type(s, pos, 'M', &mut *tm))
558558
}
559559
'r' => {
560560
parse_type(s, pos, 'I', &mut *tm)
561-
.chain(|pos| parse_char(s, pos, ':'))
562-
.chain(|pos| parse_type(s, pos, 'M', &mut *tm))
563-
.chain(|pos| parse_char(s, pos, ':'))
564-
.chain(|pos| parse_type(s, pos, 'S', &mut *tm))
565-
.chain(|pos| parse_char(s, pos, ' '))
566-
.chain(|pos| parse_type(s, pos, 'p', &mut *tm))
561+
.and_then(|pos| parse_char(s, pos, ':'))
562+
.and_then(|pos| parse_type(s, pos, 'M', &mut *tm))
563+
.and_then(|pos| parse_char(s, pos, ':'))
564+
.and_then(|pos| parse_type(s, pos, 'S', &mut *tm))
565+
.and_then(|pos| parse_char(s, pos, ' '))
566+
.and_then(|pos| parse_type(s, pos, 'p', &mut *tm))
567567
}
568568
'S' => {
569569
match match_digits_in_range(s, pos, 2u, false, 0_i32, 60_i32) {
@@ -578,10 +578,10 @@ fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
578578
//'s' {}
579579
'T' | 'X' => {
580580
parse_type(s, pos, 'H', &mut *tm)
581-
.chain(|pos| parse_char(s, pos, ':'))
582-
.chain(|pos| parse_type(s, pos, 'M', &mut *tm))
583-
.chain(|pos| parse_char(s, pos, ':'))
584-
.chain(|pos| parse_type(s, pos, 'S', &mut *tm))
581+
.and_then(|pos| parse_char(s, pos, ':'))
582+
.and_then(|pos| parse_type(s, pos, 'M', &mut *tm))
583+
.and_then(|pos| parse_char(s, pos, ':'))
584+
.and_then(|pos| parse_type(s, pos, 'S', &mut *tm))
585585
}
586586
't' => parse_char(s, pos, '\t'),
587587
'u' => {
@@ -596,10 +596,10 @@ fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
596596
}
597597
'v' => {
598598
parse_type(s, pos, 'e', &mut *tm)
599-
.chain(|pos| parse_char(s, pos, '-'))
600-
.chain(|pos| parse_type(s, pos, 'b', &mut *tm))
601-
.chain(|pos| parse_char(s, pos, '-'))
602-
.chain(|pos| parse_type(s, pos, 'Y', &mut *tm))
599+
.and_then(|pos| parse_char(s, pos, '-'))
600+
.and_then(|pos| parse_type(s, pos, 'b', &mut *tm))
601+
.and_then(|pos| parse_char(s, pos, '-'))
602+
.and_then(|pos| parse_type(s, pos, 'Y', &mut *tm))
603603
}
604604
//'W' {}
605605
'w' => {

branches/try/src/librustc/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ pub fn build_output_filenames(input: &input,
961961
if !linkage_metas.is_empty() {
962962
// But if a linkage meta is present, that overrides
963963
let maybe_name = linkage_metas.iter().find(|m| "name" == m.name());
964-
match maybe_name.chain(|m| m.value_str()) {
964+
match maybe_name.and_then(|m| m.value_str()) {
965965
Some(s) => stem = s,
966966
_ => ()
967967
}

branches/try/src/librustc/front/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn filter_view_item<'r>(cx: @Context, view_item: &'r ast::view_item)-> Option<&'
5858

5959
fn fold_mod(cx: @Context, m: &ast::_mod, fld: @fold::ast_fold) -> ast::_mod {
6060
let filtered_items = do m.items.iter().filter_map |a| {
61-
filter_item(cx, *a).chain(|x| fld.fold_item(x))
61+
filter_item(cx, *a).and_then(|x| fld.fold_item(x))
6262
}.collect();
6363
let filtered_view_items = do m.view_items.iter().filter_map |a| {
6464
do filter_view_item(cx, a).map_move |x| {
@@ -139,7 +139,7 @@ fn fold_block(
139139
fld: @fold::ast_fold
140140
) -> ast::Block {
141141
let resulting_stmts = do b.stmts.iter().filter_map |a| {
142-
filter_stmt(cx, *a).chain(|stmt| fld.fold_stmt(stmt))
142+
filter_stmt(cx, *a).and_then(|stmt| fld.fold_stmt(stmt))
143143
}.collect();
144144
let filtered_view_items = do b.view_items.iter().filter_map |a| {
145145
filter_view_item(cx, a).map(|x| fld.fold_view_item(*x))

branches/try/src/librustc/metadata/creader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ fn visit_item(e: &Env, i: @ast::item) {
184184
ast::named => {
185185
let link_name = i.attrs.iter()
186186
.find(|at| "link_name" == at.name())
187-
.chain(|at| at.value_str());
187+
.and_then(|at| at.value_str());
188188

189189
let foreign_name = match link_name {
190190
Some(nn) => {

branches/try/src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ fn each_reexport(d: ebml::Doc, f: &fn(ebml::Doc) -> bool) -> bool {
210210
}
211211

212212
fn variant_disr_val(d: ebml::Doc) -> Option<ty::Disr> {
213-
do reader::maybe_get_doc(d, tag_disr_val).chain |val_doc| {
213+
do reader::maybe_get_doc(d, tag_disr_val).and_then |val_doc| {
214214
do reader::with_doc_data(val_doc) |data| { u64::parse_bytes(data, 10u) }
215215
}
216216
}

branches/try/src/librustc/middle/trans/common.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,10 @@ impl get_node_info for ast::Block {
505505

506506
impl get_node_info for Option<@ast::Expr> {
507507
fn info(&self) -> Option<NodeInfo> {
508-
self.chain_ref(|s| s.info())
508+
match *self {
509+
Some(ref s) => s.info(),
510+
None => None,
511+
}
509512
}
510513
}
511514

branches/try/src/librustc/middle/trans/value.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ impl Value {
5050
/// must be the only user of this value, and there must not be any conditional
5151
/// branches between the store and the given block.
5252
pub fn get_dominating_store(self, bcx: @mut Block) -> Option<Value> {
53-
match self.get_single_user().chain(|user| user.as_store_inst()) {
53+
match self.get_single_user().and_then(|user| user.as_store_inst()) {
5454
Some(store) => {
55-
do store.get_parent().chain |store_bb| {
55+
do store.get_parent().and_then |store_bb| {
5656
let mut bb = BasicBlock(bcx.llbb);
5757
let mut ret = Some(store);
5858
while *bb != *store_bb {
@@ -150,7 +150,7 @@ impl Iterator<Value> for UserIterator {
150150
fn next(&mut self) -> Option<Value> {
151151
let current = self.next;
152152

153-
self.next = do current.chain |u| { u.get_next_use() };
153+
self.next = do current.and_then |u| { u.get_next_use() };
154154

155155
do current.map |u| { u.get_user() }
156156
}

branches/try/src/librustc/middle/typeck/astconv.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,17 @@ pub fn ty_of_closure<AC:AstConv,RS:RegionScope + Clone + 'static>(
745745
RegionParamNames(bound_lifetime_names.clone()));
746746

747747
let input_tys = do decl.inputs.iter().enumerate().map |(i, a)| {
748-
let expected_arg_ty = do expected_sig.chain_ref |e| {
749-
// no guarantee that the correct number of expected args
750-
// were supplied
751-
if i < e.inputs.len() {Some(e.inputs[i])} else {None}
748+
let expected_arg_ty = match expected_sig {
749+
Some(ref e) => {
750+
// no guarantee that the correct number of expected args
751+
// were supplied
752+
if i < e.inputs.len() {
753+
Some(e.inputs[i])
754+
} else {
755+
None
756+
}
757+
}
758+
None => None,
752759
};
753760
ty_of_arg(this, &rb, a, expected_arg_ty)
754761
}.collect();

0 commit comments

Comments
 (0)