Updated std::Option, std::Either and std::Result

- Made naming schemes consistent between Option, Result and Either
- Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None)
- Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
This commit is contained in:
Marvin Löbel 2013-08-04 01:59:24 +02:00
parent d8b299d179
commit 0ac7a219f0
115 changed files with 803 additions and 828 deletions

View file

@ -691,7 +691,7 @@ impl Parser {
*/
let opt_abis = self.parse_opt_abis();
let abis = opt_abis.get_or_default(AbiSet::Rust());
let abis = opt_abis.unwrap_or_default(AbiSet::Rust());
let purity = self.parse_unsafety();
self.expect_keyword(keywords::Fn);
let (decl, lifetimes) = self.parse_ty_fn_decl();
@ -3326,7 +3326,7 @@ impl Parser {
let ident = self.parse_ident();
let opt_bounds = self.parse_optional_ty_param_bounds();
// For typarams we don't care about the difference b/w "<T>" and "<T:>".
let bounds = opt_bounds.get_or_default(opt_vec::Empty);
let bounds = opt_bounds.unwrap_or_default(opt_vec::Empty);
ast::TyParam { ident: ident, id: self.get_id(), bounds: bounds }
}
@ -4196,7 +4196,7 @@ impl Parser {
self.obsolete(*self.last_span, ObsoleteExternVisibility);
}
let abis = opt_abis.get_or_default(AbiSet::C());
let abis = opt_abis.unwrap_or_default(AbiSet::C());
let (inner, next) = self.parse_inner_attrs_and_next();
let m = self.parse_foreign_mod_items(sort, abis, next);
@ -4463,7 +4463,7 @@ impl Parser {
if self.eat_keyword(keywords::Fn) {
// EXTERN FUNCTION ITEM
let abis = opt_abis.get_or_default(AbiSet::C());
let abis = opt_abis.unwrap_or_default(AbiSet::C());
let (ident, item_, extra_attrs) =
self.parse_item_fn(extern_fn, abis);
return iovi_item(self.mk_item(lo, self.last_span.hi, ident,