diff options
| author | bors <bors@rust-lang.org> | 2014-01-07 17:56:32 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-07 17:56:32 -0800 |
| commit | a121f7bab3fe21f03cef6e214d5771bfe669e48c (patch) | |
| tree | aae19d70f56d01d89be7ed95a78b494e9f987e6d /src/libsyntax | |
| parent | aa1839bd693176f03f372fb34baa7b19b5030af7 (diff) | |
| parent | 90b394514dad9df9c55b795be724093765d9df3a (diff) | |
| download | rust-a121f7bab3fe21f03cef6e214d5771bfe669e48c.tar.gz rust-a121f7bab3fe21f03cef6e214d5771bfe669e48c.zip | |
auto merge of #10854 : Kimundi/rust/result_compose_map_mutate_or, r=alexcrichton
This implements parts of the changes to `Option` I proposed and discussed in this thread: https://mail.mozilla.org/pipermail/rust-dev/2013-November/006254.html, and on IRC. In short, the string "default" should not be used in any context that has nothing to do with the `std::default::Default` trait. This PR consists of this change: - Renamed `map_default -> map_or` and `mutate_default -> mutate_or_set`.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 76327c27898..af3f0488d96 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -314,12 +314,11 @@ fn highlight_lines(cm: &codemap::CodeMap, fn print_macro_backtrace(cm: &codemap::CodeMap, sp: Span) { for ei in sp.expn_info.iter() { - let ss = ei.callee.span.as_ref().map_default(~"", |span| cm.span_to_str(*span)); + let ss = ei.callee.span.as_ref().map_or(~"", |span| cm.span_to_str(*span)); let (pre, post) = match ei.callee.format { codemap::MacroAttribute => ("#[", "]"), codemap::MacroBang => ("", "!") }; - print_diagnostic(ss, note, format!("in expansion of {}{}{}", pre, ei.callee.name, post)); let ss = cm.span_to_str(ei.call_site); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 40a2ef86e4f..60866e92efa 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -402,7 +402,7 @@ impl Parser { fn tokens_to_str(tokens: &[token::Token]) -> ~str { let mut i = tokens.iter(); // This might be a sign we need a connect method on Iterator. - let b = i.next().map_default(~"", |t| Parser::token_to_str(t)); + let b = i.next().map_or(~"", |t| Parser::token_to_str(t)); i.fold(b, |b,a| b + "`, `" + Parser::token_to_str(a)) } if edible.contains(&self.token) { @@ -467,7 +467,7 @@ impl Parser { pub fn commit_stmt(&mut self, s: @Stmt, edible: &[token::Token], inedible: &[token::Token]) { debug!("commit_stmt {:?}", s); let _s = s; // unused, but future checks might want to inspect `s`. - if self.last_token.as_ref().map_default(false, |t| is_ident_or_path(*t)) { + if self.last_token.as_ref().map_or(false, |t| is_ident_or_path(*t)) { let expected = vec::append(edible.to_owned(), inedible); self.check_for_erroneous_unit_struct_expecting(expected); } |
