Renamed Option::map_default and mutate_default to map_or and mutate_or_set

This commit is contained in:
Marvin Löbel 2013-12-06 19:51:10 +01:00
parent 4329fc6730
commit 90b394514d
18 changed files with 43 additions and 44 deletions

View file

@ -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);

View file

@ -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);
}