1
Fork 0

auto merge of #16664 : aturon/rust/stabilize-option-result, r=alexcrichton

Per API meeting

  https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-08-13.md

# Changes to `core::option`

Most of the module is marked as stable or unstable; most of the unstable items are awaiting resolution of conventions issues.

However, a few methods have been deprecated, either due to lack of use or redundancy:

* `take_unwrap`, `get_ref` and `get_mut_ref` (redundant, and we prefer for this functionality to go through an explicit .unwrap)
* `filtered` and `while`
* `mutate` and `mutate_or_set`
* `collect`: this functionality is being moved to a new `FromIterator` impl.

# Changes to `core::result`

Most of the module is marked as stable or unstable; most of the unstable items are awaiting resolution of conventions issues.

* `collect`: this functionality is being moved to a new `FromIterator` impl.
* `fold_` is deprecated due to lack of use
* Several methods found in `core::option` are added here, including `iter`, `as_slice`, and variants.

Due to deprecations, this is a:

[breaking-change]
This commit is contained in:
bors 2014-08-28 23:56:20 +00:00
commit 2e92c67dc0
47 changed files with 400 additions and 202 deletions

View file

@ -297,7 +297,7 @@ pub fn run(mut krate: clean::Crate, external_html: &ExternalHtml, dst: Path) ->
let public_items = public_items.unwrap_or(NodeSet::new());
let paths: HashMap<ast::DefId, (Vec<String>, ItemType)> =
analysis.as_ref().map(|a| {
let paths = a.external_paths.borrow_mut().take_unwrap();
let paths = a.external_paths.borrow_mut().take().unwrap();
paths.move_iter().map(|(k, (v, t))| {
(k, (v, match t {
clean::TypeStruct => item_type::Struct,
@ -325,13 +325,13 @@ pub fn run(mut krate: clean::Crate, external_html: &ExternalHtml, dst: Path) ->
public_items: public_items,
orphan_methods: Vec::new(),
traits: analysis.as_ref().map(|a| {
a.external_traits.borrow_mut().take_unwrap()
a.external_traits.borrow_mut().take().unwrap()
}).unwrap_or(HashMap::new()),
typarams: analysis.as_ref().map(|a| {
a.external_typarams.borrow_mut().take_unwrap()
a.external_typarams.borrow_mut().take().unwrap()
}).unwrap_or(HashMap::new()),
inlined: analysis.as_ref().map(|a| {
a.inlined.borrow_mut().take_unwrap()
a.inlined.borrow_mut().take().unwrap()
}).unwrap_or(HashSet::new()),
};
cache.stack.push(krate.name.clone());
@ -805,7 +805,7 @@ impl DocFolder for Cache {
v.push(Implementor {
def_id: item.def_id,
generics: i.generics.clone(),
trait_: i.trait_.get_ref().clone(),
trait_: i.trait_.as_ref().unwrap().clone(),
for_: i.for_.clone(),
stability: item.stability.clone(),
});
@ -878,7 +878,7 @@ impl DocFolder for Cache {
// Keep track of the fully qualified path for this item.
let pushed = if item.name.is_some() {
let n = item.name.get_ref();
let n = item.name.as_ref().unwrap();
if n.len() > 0 {
self.stack.push(n.to_string());
true
@ -1125,7 +1125,7 @@ impl Context {
if title.len() > 0 {
title.push_str("::");
}
title.push_str(it.name.get_ref().as_slice());
title.push_str(it.name.as_ref().unwrap().as_slice());
}
title.push_str(" - Rust");
let tyname = shortty(it).to_static_str();
@ -1191,10 +1191,10 @@ impl Context {
// modules are special because they add a namespace. We also need to
// recurse into the items of the module as well.
clean::ModuleItem(..) => {
let name = item.name.get_ref().to_string();
let name = item.name.as_ref().unwrap().to_string();
let mut item = Some(item);
self.recurse(name, |this| {
let item = item.take_unwrap();
let item = item.take().unwrap();
let dst = this.dst.join("index.html");
let dst = try!(File::create(&dst));
try!(render(dst, this, &item, false));
@ -1398,7 +1398,7 @@ fn item_path(item: &clean::Item) -> String {
fn full_path(cx: &Context, item: &clean::Item) -> String {
let mut s = cx.current.connect("::");
s.push_str("::");
s.push_str(item.name.get_ref().as_slice());
s.push_str(item.name.as_ref().unwrap().as_slice());
return s
}
@ -1809,7 +1809,7 @@ fn item_enum(w: &mut fmt::Formatter, it: &clean::Item,
try!(write!(w, " {{\n"));
for v in e.variants.iter() {
try!(write!(w, " "));
let name = v.name.get_ref().as_slice();
let name = v.name.as_ref().unwrap().as_slice();
match v.inner {
clean::VariantItem(ref var) => {
match var.kind {
@ -2098,7 +2098,7 @@ impl<'a> fmt::Show for Sidebar<'a> {
try!(write!(w, "<div class='block {}'><h2>{}</h2>", short, longty));
for item in items.iter() {
let curty = shortty(cur).to_static_str();
let class = if cur.name.get_ref() == item &&
let class = if cur.name.as_ref().unwrap() == item &&
short == curty { "current" } else { "" };
try!(write!(w, "<a class='{ty} {class}' href='{href}{path}'>\
{name}</a>",