Fallout from collection conventions
This commit is contained in:
parent
cf3b2e4fe6
commit
eec145be3f
101 changed files with 418 additions and 417 deletions
|
|
@ -45,7 +45,7 @@ pub fn try_inline(cx: &DocContext, id: ast::NodeId, into: Option<ast::Ident>)
|
|||
Some(tcx) => tcx,
|
||||
None => return None,
|
||||
};
|
||||
let def = match tcx.def_map.borrow().find(&id) {
|
||||
let def = match tcx.def_map.borrow().get(&id) {
|
||||
Some(def) => *def,
|
||||
None => return None,
|
||||
};
|
||||
|
|
@ -223,7 +223,7 @@ fn build_impls(cx: &DocContext, tcx: &ty::ctxt,
|
|||
ty::populate_implementations_for_type_if_necessary(tcx, did);
|
||||
let mut impls = Vec::new();
|
||||
|
||||
match tcx.inherent_impls.borrow().find(&did) {
|
||||
match tcx.inherent_impls.borrow().get(&did) {
|
||||
None => {}
|
||||
Some(i) => {
|
||||
impls.extend(i.iter().map(|&did| { build_impl(cx, tcx, did) }));
|
||||
|
|
|
|||
|
|
@ -1395,7 +1395,7 @@ impl Clean<Item> for ty::field_ty {
|
|||
let (name, attrs) = if self.name == unnamed_field.name {
|
||||
(None, None)
|
||||
} else {
|
||||
(Some(self.name), Some(attr_map.find(&self.id.node).unwrap()))
|
||||
(Some(self.name), Some(attr_map.get(&self.id.node).unwrap()))
|
||||
};
|
||||
|
||||
let ty = ty::lookup_item_type(cx.tcx(), self.id);
|
||||
|
|
@ -2090,7 +2090,7 @@ fn resolve_type(cx: &DocContext, path: Path,
|
|||
None => return Primitive(Bool),
|
||||
};
|
||||
debug!("searching for {} in defmap", id);
|
||||
let def = match tcx.def_map.borrow().find(&id) {
|
||||
let def = match tcx.def_map.borrow().get(&id) {
|
||||
Some(&k) => k,
|
||||
None => panic!("unresolved id not in defmap")
|
||||
};
|
||||
|
|
@ -2159,7 +2159,7 @@ fn resolve_use_source(cx: &DocContext, path: Path, id: ast::NodeId) -> ImportSou
|
|||
|
||||
fn resolve_def(cx: &DocContext, id: ast::NodeId) -> Option<ast::DefId> {
|
||||
cx.tcx_opt().and_then(|tcx| {
|
||||
tcx.def_map.borrow().find(&id).map(|&def| register_def(cx, def))
|
||||
tcx.def_map.borrow().get(&id).map(|&def| register_def(cx, def))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ fn resolved_path(w: &mut fmt::Formatter, did: ast::DefId, p: &clean::Path,
|
|||
}
|
||||
},
|
||||
|cache| {
|
||||
match cache.paths.find(&did) {
|
||||
match cache.paths.get(&did) {
|
||||
None => None,
|
||||
Some(&(ref fqp, shortty)) => Some((fqp.clone(), shortty))
|
||||
}
|
||||
|
|
@ -313,7 +313,7 @@ fn primitive_link(f: &mut fmt::Formatter,
|
|||
name: &str) -> fmt::Result {
|
||||
let m = cache_key.get().unwrap();
|
||||
let mut needs_termination = false;
|
||||
match m.primitive_locations.find(&prim) {
|
||||
match m.primitive_locations.get(&prim) {
|
||||
Some(&ast::LOCAL_CRATE) => {
|
||||
let loc = current_location_key.get().unwrap();
|
||||
let len = if loc.len() == 0 {0} else {loc.len() - 1};
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
|
|||
|
||||
// Make sure our hyphenated ID is unique for this page
|
||||
let map = used_header_map.get().unwrap();
|
||||
let id = match map.borrow_mut().find_mut(&id) {
|
||||
let id = match map.borrow_mut().get_mut(&id) {
|
||||
None => id,
|
||||
Some(a) => { *a += 1; format!("{}-{}", id, *a - 1) }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String>
|
|||
// has since been learned.
|
||||
for &(pid, ref item) in orphan_methods.iter() {
|
||||
let did = ast_util::local_def(pid);
|
||||
match paths.find(&did) {
|
||||
match paths.get(&did) {
|
||||
Some(&(ref fqp, _)) => {
|
||||
search_index.push(IndexItem {
|
||||
ty: shortty(item),
|
||||
|
|
@ -443,7 +443,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String>
|
|||
item.desc.to_json().to_string()));
|
||||
match item.parent {
|
||||
Some(nodeid) => {
|
||||
let pathid = *nodeid_to_pathid.find(&nodeid).unwrap();
|
||||
let pathid = *nodeid_to_pathid.get(&nodeid).unwrap();
|
||||
try!(write!(&mut w, ",{}", pathid));
|
||||
}
|
||||
None => {}
|
||||
|
|
@ -454,7 +454,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String>
|
|||
try!(write!(&mut w, r#"],"paths":["#));
|
||||
|
||||
for (i, &did) in pathid_to_nodeid.iter().enumerate() {
|
||||
let &(ref fqp, short) = cache.paths.find(&did).unwrap();
|
||||
let &(ref fqp, short) = cache.paths.get(&did).unwrap();
|
||||
if i > 0 {
|
||||
try!(write!(&mut w, ","));
|
||||
}
|
||||
|
|
@ -543,7 +543,7 @@ fn write_shared(cx: &Context,
|
|||
//
|
||||
// FIXME: this is a vague explanation for why this can't be a `get`, in
|
||||
// theory it should be...
|
||||
let &(ref remote_path, remote_item_type) = match cache.paths.find(&did) {
|
||||
let &(ref remote_path, remote_item_type) = match cache.paths.get(&did) {
|
||||
Some(p) => p,
|
||||
None => continue,
|
||||
};
|
||||
|
|
@ -838,7 +838,7 @@ impl DocFolder for Cache {
|
|||
} else {
|
||||
let last = self.parent_stack.last().unwrap();
|
||||
let did = *last;
|
||||
let path = match self.paths.find(&did) {
|
||||
let path = match self.paths.get(&did) {
|
||||
Some(&(_, item_type::Trait)) =>
|
||||
Some(self.stack[..self.stack.len() - 1]),
|
||||
// The current stack not necessarily has correlation for
|
||||
|
|
@ -1170,7 +1170,7 @@ impl Context {
|
|||
&Item{ cx: cx, item: it }));
|
||||
} else {
|
||||
let mut url = "../".repeat(cx.current.len());
|
||||
match cache_key.get().unwrap().paths.find(&it.def_id) {
|
||||
match cache_key.get().unwrap().paths.get(&it.def_id) {
|
||||
Some(&(ref names, _)) => {
|
||||
for name in names[..names.len() - 1].iter() {
|
||||
url.push_str(name.as_slice());
|
||||
|
|
@ -1735,7 +1735,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
|||
<h2 id='implementors'>Implementors</h2>
|
||||
<ul class='item-list' id='implementors-list'>
|
||||
"));
|
||||
match cache.implementors.find(&it.def_id) {
|
||||
match cache.implementors.get(&it.def_id) {
|
||||
Some(implementors) => {
|
||||
for i in implementors.iter() {
|
||||
try!(writeln!(w, "<li>{}<code>impl{} {} for {}{}</code></li>",
|
||||
|
|
@ -1992,7 +1992,7 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
|
|||
}
|
||||
|
||||
fn render_methods(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
|
||||
match cache_key.get().unwrap().impls.find(&it.def_id) {
|
||||
match cache_key.get().unwrap().impls.get(&it.def_id) {
|
||||
Some(v) => {
|
||||
let (non_trait, traits) = v.partitioned(|i| i.impl_.trait_.is_none());
|
||||
if non_trait.len() > 0 {
|
||||
|
|
@ -2080,7 +2080,7 @@ fn render_impl(w: &mut fmt::Formatter, i: &Impl) -> fmt::Result {
|
|||
match i.impl_.trait_ {
|
||||
Some(clean::ResolvedPath { did, .. }) => {
|
||||
try!({
|
||||
match cache_key.get().unwrap().traits.find(&did) {
|
||||
match cache_key.get().unwrap().traits.get(&did) {
|
||||
Some(t) => try!(render_default_methods(w, t, &i.impl_)),
|
||||
None => {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ fn json_input(input: &str) -> Result<Output, String> {
|
|||
Ok(json::Object(obj)) => {
|
||||
let mut obj = obj;
|
||||
// Make sure the schema is what we expect
|
||||
match obj.pop(&"schema".to_string()) {
|
||||
match obj.remove(&"schema".to_string()) {
|
||||
Some(json::String(version)) => {
|
||||
if version.as_slice() != SCHEMA_VERSION {
|
||||
return Err(format!(
|
||||
|
|
@ -428,7 +428,7 @@ fn json_input(input: &str) -> Result<Output, String> {
|
|||
Some(..) => return Err("malformed json".to_string()),
|
||||
None => return Err("expected a schema version".to_string()),
|
||||
}
|
||||
let krate = match obj.pop(&"crate".to_string()) {
|
||||
let krate = match obj.remove(&"crate".to_string()) {
|
||||
Some(json) => {
|
||||
let mut d = json::Decoder::new(json);
|
||||
Decodable::decode(&mut d).unwrap()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue