Skip to content

Commit 1c39fda

Browse files
committed
Rename option::get_or_default to get_default, for consistency
1 parent 9280d0c commit 1c39fda

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/libcore/option.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pure fn is_some<T>(opt: option<T>) -> bool {
5252
!is_none(opt)
5353
}
5454

55-
pure fn get_or_default<T: copy>(opt: option<T>, def: T) -> T {
55+
pure fn get_default<T: copy>(opt: option<T>, def: T) -> T {
5656
#[doc = "Returns the contained value or a default"];
5757

5858
alt opt { some(x) { x } none { def } }
@@ -94,7 +94,7 @@ impl extensions<T:copy> for option<T> {
9494
"]
9595
fn chain<U>(f: fn(T) -> option<U>) -> option<U> { chain(self, f) }
9696
#[doc = "Returns the contained value or a default"]
97-
fn get_or_default(def: T) -> T { get_or_default(self, def) }
97+
fn get_default(def: T) -> T { get_default(self, def) }
9898
#[doc = "Applies a function to the contained value or returns a default"]
9999
fn map_default<U: copy>(def: U, f: fn(T) -> U) -> U
100100
{ map_default(self, def, f) }

src/librustsyntax/parse/eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn eval_crate_directives_to_mod(cx: ctx, cdirs: [@ast::crate_directive],
2222
-> (ast::_mod, [ast::attribute]) {
2323
#debug("eval crate prefix: %s", prefix);
2424
#debug("eval crate suffix: %s",
25-
option::get_or_default(suffix, "none"));
25+
option::get_default(suffix, "none"));
2626
let (cview_items, citems, cattrs)
2727
= parse_companion_mod(cx, prefix, suffix);
2828
let mut view_items: [@ast::view_item] = [];

src/rustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2017,7 +2017,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, real_substs: [ty::t],
20172017
// ctors don't have attrs, at least not right now
20182018
let tp_tys: [ty::t] = ty::ty_params_to_tys(ccx.tcx, tps);
20192019
trans_class_ctor(ccx, pt, ctor.node.dec, ctor.node.body, lldecl,
2020-
option::get_or_default(psubsts,
2020+
option::get_default(psubsts,
20212021
{tys:tp_tys, vtables: none, bounds: @[]}),
20222022
fn_id.node, parent_id, ctor.span);
20232023
}

src/rustdoc/attr_pass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn fold_crate(
5050
{
5151
topmod: {
5252
item: {
53-
name: option::get_or_default(attrs.name, doc.topmod.name())
53+
name: option::get_default(attrs.name, doc.topmod.name())
5454
with doc.topmod.item
5555
}
5656
with doc.topmod

src/rustdoc/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fn config_from_opts(
125125
let result = result::chain(result) {|config|
126126
let output_dir = getopts::opt_maybe_str(match, opt_output_dir());
127127
result::ok({
128-
output_dir: option::get_or_default(output_dir, config.output_dir)
128+
output_dir: option::get_default(output_dir, config.output_dir)
129129
with config
130130
})
131131
};

0 commit comments

Comments
 (0)