rollup merge of #21830: japaric/for-cleanup
Conflicts: src/librustc/metadata/filesearch.rs src/librustc_back/target/mod.rs src/libstd/os.rs src/libstd/sys/windows/os.rs src/libsyntax/ext/tt/macro_parser.rs src/libsyntax/print/pprust.rs src/test/compile-fail/issue-2149.rs
This commit is contained in:
commit
7335c7dd63
319 changed files with 1308 additions and 1443 deletions
|
|
@ -166,7 +166,7 @@ impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> {
|
|||
_ => unreachable!(),
|
||||
};
|
||||
let mut tmp = Vec::new();
|
||||
for child in m.items.iter_mut() {
|
||||
for child in &mut m.items {
|
||||
match child.inner {
|
||||
ModuleItem(..) => {}
|
||||
_ => continue,
|
||||
|
|
@ -254,7 +254,7 @@ impl Item {
|
|||
/// Finds the `doc` attribute as a List and returns the list of attributes
|
||||
/// nested inside.
|
||||
pub fn doc_list<'a>(&'a self) -> Option<&'a [Attribute]> {
|
||||
for attr in self.attrs.iter() {
|
||||
for attr in &self.attrs {
|
||||
match *attr {
|
||||
List(ref x, ref list) if "doc" == *x => {
|
||||
return Some(list.as_slice());
|
||||
|
|
@ -268,7 +268,7 @@ impl Item {
|
|||
/// Finds the `doc` attribute as a NameValue and returns the corresponding
|
||||
/// value found.
|
||||
pub fn doc_value<'a>(&'a self) -> Option<&'a str> {
|
||||
for attr in self.attrs.iter() {
|
||||
for attr in &self.attrs {
|
||||
match *attr {
|
||||
NameValue(ref x, ref v) if "doc" == *x => {
|
||||
return Some(v.as_slice());
|
||||
|
|
@ -281,8 +281,8 @@ impl Item {
|
|||
|
||||
pub fn is_hidden_from_doc(&self) -> bool {
|
||||
match self.doc_list() {
|
||||
Some(ref l) => {
|
||||
for innerattr in l.iter() {
|
||||
Some(l) => {
|
||||
for innerattr in l {
|
||||
match *innerattr {
|
||||
Word(ref s) if "hidden" == *s => {
|
||||
return true
|
||||
|
|
@ -508,12 +508,12 @@ impl<'tcx> Clean<(Vec<TyParamBound>, Vec<TypeBinding>)> for ty::ExistentialBound
|
|||
fn clean(&self, cx: &DocContext) -> (Vec<TyParamBound>, Vec<TypeBinding>) {
|
||||
let mut tp_bounds = vec![];
|
||||
self.region_bound.clean(cx).map(|b| tp_bounds.push(RegionBound(b)));
|
||||
for bb in self.builtin_bounds.iter() {
|
||||
for bb in &self.builtin_bounds {
|
||||
tp_bounds.push(bb.clean(cx));
|
||||
}
|
||||
|
||||
let mut bindings = vec![];
|
||||
for &ty::Binder(ref pb) in self.projection_bounds.iter() {
|
||||
for &ty::Binder(ref pb) in &self.projection_bounds {
|
||||
bindings.push(TypeBinding {
|
||||
name: pb.projection_ty.item_name.clean(cx),
|
||||
ty: pb.ty.clean(cx)
|
||||
|
|
@ -636,10 +636,10 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
|
|||
|
||||
// collect any late bound regions
|
||||
let mut late_bounds = vec![];
|
||||
for &ty_s in self.substs.types.get_slice(ParamSpace::TypeSpace).iter() {
|
||||
for &ty_s in self.substs.types.get_slice(ParamSpace::TypeSpace) {
|
||||
use rustc::middle::ty::{Region, sty};
|
||||
if let sty::ty_tup(ref ts) = ty_s.sty {
|
||||
for &ty_s in ts.iter() {
|
||||
for &ty_s in ts {
|
||||
if let sty::ty_rptr(ref reg, _) = ty_s.sty {
|
||||
if let &Region::ReLateBound(_, _) = *reg {
|
||||
debug!(" hit an ReLateBound {:?}", reg);
|
||||
|
|
@ -662,7 +662,7 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
|
|||
impl<'tcx> Clean<Vec<TyParamBound>> for ty::ParamBounds<'tcx> {
|
||||
fn clean(&self, cx: &DocContext) -> Vec<TyParamBound> {
|
||||
let mut v = Vec::new();
|
||||
for t in self.trait_bounds.iter() {
|
||||
for t in &self.trait_bounds {
|
||||
v.push(t.clean(cx));
|
||||
}
|
||||
for r in self.region_bounds.iter().filter_map(|r| r.clean(cx)) {
|
||||
|
|
@ -872,7 +872,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics<'tcx>, subst::ParamSpace) {
|
|||
Some(did) => did,
|
||||
None => return false
|
||||
};
|
||||
for bound in bounds.iter() {
|
||||
for bound in bounds {
|
||||
if let TyParamBound::TraitBound(PolyTrait {
|
||||
trait_: Type::ResolvedPath { did, .. }, ..
|
||||
}, TBM::None) = *bound {
|
||||
|
|
@ -915,7 +915,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics<'tcx>, subst::ParamSpace) {
|
|||
}).collect::<Vec<_>>();
|
||||
// Finally, run through the type parameters again and insert a ?Sized unbound for
|
||||
// any we didn't find to be Sized.
|
||||
for tp in stripped_typarams.iter() {
|
||||
for tp in &stripped_typarams {
|
||||
if !sized_params.contains(&tp.name) {
|
||||
let mut sized_bound = ty::BuiltinBound::BoundSized.clean(cx);
|
||||
if let TyParamBound::TraitBound(_, ref mut tbm) = sized_bound {
|
||||
|
|
@ -1420,12 +1420,12 @@ impl PrimitiveType {
|
|||
}
|
||||
|
||||
fn find(attrs: &[Attribute]) -> Option<PrimitiveType> {
|
||||
for attr in attrs.iter() {
|
||||
for attr in attrs {
|
||||
let list = match *attr {
|
||||
List(ref k, ref l) if *k == "doc" => l,
|
||||
_ => continue,
|
||||
};
|
||||
for sub_attr in list.iter() {
|
||||
for sub_attr in list {
|
||||
let value = match *sub_attr {
|
||||
NameValue(ref k, ref v)
|
||||
if *k == "primitive" => v.as_slice(),
|
||||
|
|
@ -2175,7 +2175,7 @@ impl Clean<Vec<Item>> for doctree::Import {
|
|||
let mut ret = vec![];
|
||||
let remaining = if !denied {
|
||||
let mut remaining = vec![];
|
||||
for path in list.iter() {
|
||||
for path in list {
|
||||
match inline::try_inline(cx, path.node.id(), None) {
|
||||
Some(items) => {
|
||||
ret.extend(items.into_iter());
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ macro_rules! load_or_return {
|
|||
|
||||
pub fn load_external_files(names: &[String]) -> Option<String> {
|
||||
let mut out = String::new();
|
||||
for name in names.iter() {
|
||||
for name in names {
|
||||
out.push_str(load_or_return!(name.as_slice(), None, None).as_slice());
|
||||
out.push('\n');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,21 +212,21 @@ impl fmt::Display for clean::PathParameters {
|
|||
if lifetimes.len() > 0 || types.len() > 0 || bindings.len() > 0 {
|
||||
try!(f.write_str("<"));
|
||||
let mut comma = false;
|
||||
for lifetime in lifetimes.iter() {
|
||||
for lifetime in lifetimes {
|
||||
if comma {
|
||||
try!(f.write_str(", "));
|
||||
}
|
||||
comma = true;
|
||||
try!(write!(f, "{}", *lifetime));
|
||||
}
|
||||
for ty in types.iter() {
|
||||
for ty in types {
|
||||
if comma {
|
||||
try!(f.write_str(", "));
|
||||
}
|
||||
comma = true;
|
||||
try!(write!(f, "{}", *ty));
|
||||
}
|
||||
for binding in bindings.iter() {
|
||||
for binding in bindings {
|
||||
if comma {
|
||||
try!(f.write_str(", "));
|
||||
}
|
||||
|
|
@ -239,7 +239,7 @@ impl fmt::Display for clean::PathParameters {
|
|||
clean::PathParameters::Parenthesized { ref inputs, ref output } => {
|
||||
try!(f.write_str("("));
|
||||
let mut comma = false;
|
||||
for ty in inputs.iter() {
|
||||
for ty in inputs {
|
||||
if comma {
|
||||
try!(f.write_str(", "));
|
||||
}
|
||||
|
|
@ -332,7 +332,7 @@ fn path<F, G>(w: &mut fmt::Formatter,
|
|||
match rel_root {
|
||||
Some(root) => {
|
||||
let mut root = String::from_str(root.as_slice());
|
||||
for seg in path.segments[..amt].iter() {
|
||||
for seg in &path.segments[..amt] {
|
||||
if "super" == seg.name ||
|
||||
"self" == seg.name {
|
||||
try!(write!(w, "{}::", seg.name));
|
||||
|
|
@ -347,7 +347,7 @@ fn path<F, G>(w: &mut fmt::Formatter,
|
|||
}
|
||||
}
|
||||
None => {
|
||||
for seg in path.segments[..amt].iter() {
|
||||
for seg in &path.segments[..amt] {
|
||||
try!(write!(w, "{}::", seg.name));
|
||||
}
|
||||
}
|
||||
|
|
@ -359,7 +359,7 @@ fn path<F, G>(w: &mut fmt::Formatter,
|
|||
Some((ref fqp, shortty)) if abs_root.is_some() => {
|
||||
let mut url = String::from_str(abs_root.unwrap().as_slice());
|
||||
let to_link = &fqp[..fqp.len() - 1];
|
||||
for component in to_link.iter() {
|
||||
for component in to_link {
|
||||
url.push_str(component.as_slice());
|
||||
url.push_str("/");
|
||||
}
|
||||
|
|
@ -440,7 +440,7 @@ fn tybounds(w: &mut fmt::Formatter,
|
|||
typarams: &Option<Vec<clean::TyParamBound> >) -> fmt::Result {
|
||||
match *typarams {
|
||||
Some(ref params) => {
|
||||
for param in params.iter() {
|
||||
for param in params {
|
||||
try!(write!(w, " + "));
|
||||
try!(write!(w, "{}", *param));
|
||||
}
|
||||
|
|
@ -770,7 +770,7 @@ impl fmt::Display for ModuleSummary {
|
|||
(100 * cnt.unmarked) as f64/tot as f64));
|
||||
try!(write!(f, "</td></tr>"));
|
||||
|
||||
for submodule in m.submodules.iter() {
|
||||
for submodule in &m.submodules {
|
||||
try!(fmt_inner(f, context, submodule));
|
||||
}
|
||||
context.pop();
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ pub fn run(mut krate: clean::Crate,
|
|||
let default: &[_] = &[];
|
||||
match krate.module.as_ref().map(|m| m.doc_list().unwrap_or(default)) {
|
||||
Some(attrs) => {
|
||||
for attr in attrs.iter() {
|
||||
for attr in attrs {
|
||||
match *attr {
|
||||
clean::NameValue(ref x, ref s)
|
||||
if "html_favicon_url" == *x => {
|
||||
|
|
@ -353,7 +353,7 @@ pub fn run(mut krate: clean::Crate,
|
|||
krate = cache.fold_crate(krate);
|
||||
|
||||
// Cache where all our extern crates are located
|
||||
for &(n, ref e) in krate.externs.iter() {
|
||||
for &(n, ref e) in &krate.externs {
|
||||
cache.extern_locations.insert(n, extern_location(e, &cx.dst));
|
||||
let did = ast::DefId { krate: n, node: ast::CRATE_NODE_ID };
|
||||
cache.paths.insert(did, (vec![e.name.to_string()], ItemType::Module));
|
||||
|
|
@ -364,11 +364,11 @@ pub fn run(mut krate: clean::Crate,
|
|||
// Favor linking to as local extern as possible, so iterate all crates in
|
||||
// reverse topological order.
|
||||
for &(n, ref e) in krate.externs.iter().rev() {
|
||||
for &prim in e.primitives.iter() {
|
||||
for &prim in &e.primitives {
|
||||
cache.primitive_locations.insert(prim, n);
|
||||
}
|
||||
}
|
||||
for &prim in krate.primitives.iter() {
|
||||
for &prim in &krate.primitives {
|
||||
cache.primitive_locations.insert(prim, ast::LOCAL_CRATE);
|
||||
}
|
||||
|
||||
|
|
@ -402,7 +402,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> old_io::IoResult<Stri
|
|||
|
||||
// Attach all orphan methods to the type's definition if the type
|
||||
// has since been learned.
|
||||
for &(pid, ref item) in orphan_methods.iter() {
|
||||
for &(pid, ref item) in orphan_methods {
|
||||
let did = ast_util::local_def(pid);
|
||||
match paths.get(&did) {
|
||||
Some(&(ref fqp, _)) => {
|
||||
|
|
@ -420,7 +420,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> old_io::IoResult<Stri
|
|||
|
||||
// Reduce `NodeId` in paths into smaller sequential numbers,
|
||||
// and prune the paths that do not appear in the index.
|
||||
for item in search_index.iter() {
|
||||
for item in &*search_index {
|
||||
match item.parent {
|
||||
Some(nodeid) => {
|
||||
if !nodeid_to_pathid.contains_key(&nodeid) {
|
||||
|
|
@ -542,7 +542,7 @@ fn write_shared(cx: &Context,
|
|||
let mut w = try!(File::create(&dst));
|
||||
try!(writeln!(&mut w, "var searchIndex = {{}};"));
|
||||
try!(writeln!(&mut w, "{}", search_index));
|
||||
for index in all_indexes.iter() {
|
||||
for index in &all_indexes {
|
||||
try!(writeln!(&mut w, "{}", *index));
|
||||
}
|
||||
try!(writeln!(&mut w, "initSearch(searchIndex);"));
|
||||
|
|
@ -550,7 +550,7 @@ fn write_shared(cx: &Context,
|
|||
// Update the list of all implementors for traits
|
||||
let dst = cx.dst.join("implementors");
|
||||
try!(mkdir(&dst));
|
||||
for (&did, imps) in cache.implementors.iter() {
|
||||
for (&did, imps) in &cache.implementors {
|
||||
// Private modules can leak through to this phase of rustdoc, which
|
||||
// could contain implementations for otherwise private types. In some
|
||||
// rare cases we could find an implementation for an item which wasn't
|
||||
|
|
@ -564,7 +564,7 @@ fn write_shared(cx: &Context,
|
|||
};
|
||||
|
||||
let mut mydst = dst.clone();
|
||||
for part in remote_path[..remote_path.len() - 1].iter() {
|
||||
for part in &remote_path[..remote_path.len() - 1] {
|
||||
mydst.push(part.as_slice());
|
||||
try!(mkdir(&mydst));
|
||||
}
|
||||
|
|
@ -578,12 +578,12 @@ fn write_shared(cx: &Context,
|
|||
let mut f = BufferedWriter::new(try!(File::create(&mydst)));
|
||||
try!(writeln!(&mut f, "(function() {{var implementors = {{}};"));
|
||||
|
||||
for implementor in all_implementors.iter() {
|
||||
for implementor in &all_implementors {
|
||||
try!(write!(&mut f, "{}", *implementor));
|
||||
}
|
||||
|
||||
try!(write!(&mut f, r"implementors['{}'] = [", krate.name));
|
||||
for imp in imps.iter() {
|
||||
for imp in imps {
|
||||
// If the trait and implementation are in the same crate, then
|
||||
// there's no need to emit information about it (there's inlining
|
||||
// going on). If they're in different crates then the crate defining
|
||||
|
|
@ -679,10 +679,10 @@ fn extern_location(e: &clean::ExternalCrate, dst: &Path) -> ExternalLocation {
|
|||
|
||||
// Failing that, see if there's an attribute specifying where to find this
|
||||
// external crate
|
||||
for attr in e.attrs.iter() {
|
||||
for attr in &e.attrs {
|
||||
match *attr {
|
||||
clean::List(ref x, ref list) if "doc" == *x => {
|
||||
for attr in list.iter() {
|
||||
for attr in list {
|
||||
match *attr {
|
||||
clean::NameValue(ref x, ref s)
|
||||
if "html_root_url" == *x => {
|
||||
|
|
@ -1043,7 +1043,7 @@ impl DocFolder for Cache {
|
|||
|
||||
impl<'a> Cache {
|
||||
fn generics(&mut self, generics: &clean::Generics) {
|
||||
for typ in generics.type_params.iter() {
|
||||
for typ in &generics.type_params {
|
||||
self.typarams.insert(typ.did, typ.name.clone());
|
||||
}
|
||||
}
|
||||
|
|
@ -1190,7 +1190,7 @@ impl Context {
|
|||
.collect::<String>();
|
||||
match cache().paths.get(&it.def_id) {
|
||||
Some(&(ref names, _)) => {
|
||||
for name in (&names[..names.len() - 1]).iter() {
|
||||
for name in &names[..names.len() - 1] {
|
||||
url.push_str(name.as_slice());
|
||||
url.push_str("/");
|
||||
}
|
||||
|
|
@ -1231,7 +1231,7 @@ impl Context {
|
|||
_ => unreachable!()
|
||||
};
|
||||
this.sidebar = this.build_sidebar(&m);
|
||||
for item in m.items.into_iter() {
|
||||
for item in m.items {
|
||||
f(this,item);
|
||||
}
|
||||
Ok(())
|
||||
|
|
@ -1252,7 +1252,7 @@ impl Context {
|
|||
|
||||
fn build_sidebar(&self, m: &clean::Module) -> HashMap<String, Vec<NameDoc>> {
|
||||
let mut map = HashMap::new();
|
||||
for item in m.items.iter() {
|
||||
for item in &m.items {
|
||||
if self.ignore_private_item(item) { continue }
|
||||
|
||||
// avoid putting foreign items to the sidebar.
|
||||
|
|
@ -1270,7 +1270,7 @@ impl Context {
|
|||
v.push(NameDoc(myname, Some(shorter_line(item.doc_value()))));
|
||||
}
|
||||
|
||||
for (_, items) in map.iter_mut() {
|
||||
for (_, items) in &mut map {
|
||||
items.sort();
|
||||
}
|
||||
return map;
|
||||
|
|
@ -1536,7 +1536,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
|
|||
|
||||
debug!("{:?}", indices);
|
||||
let mut curty = None;
|
||||
for &idx in indices.iter() {
|
||||
for &idx in &indices {
|
||||
let myitem = &items[idx];
|
||||
|
||||
let myty = Some(shortty(myitem));
|
||||
|
|
@ -1696,7 +1696,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
|||
try!(write!(w, "{{ }}"));
|
||||
} else {
|
||||
try!(write!(w, "{{\n"));
|
||||
for t in types.iter() {
|
||||
for t in &types {
|
||||
try!(write!(w, " "));
|
||||
try!(render_method(w, t.item()));
|
||||
try!(write!(w, ";\n"));
|
||||
|
|
@ -1704,7 +1704,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
|||
if types.len() > 0 && required.len() > 0 {
|
||||
try!(w.write_str("\n"));
|
||||
}
|
||||
for m in required.iter() {
|
||||
for m in &required {
|
||||
try!(write!(w, " "));
|
||||
try!(render_method(w, m.item()));
|
||||
try!(write!(w, ";\n"));
|
||||
|
|
@ -1712,7 +1712,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
|||
if required.len() > 0 && provided.len() > 0 {
|
||||
try!(w.write_str("\n"));
|
||||
}
|
||||
for m in provided.iter() {
|
||||
for m in &provided {
|
||||
try!(write!(w, " "));
|
||||
try!(render_method(w, m.item()));
|
||||
try!(write!(w, " {{ ... }}\n"));
|
||||
|
|
@ -1741,7 +1741,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
|||
<h2 id='associated-types'>Associated Types</h2>
|
||||
<div class='methods'>
|
||||
"));
|
||||
for t in types.iter() {
|
||||
for t in &types {
|
||||
try!(trait_item(w, *t));
|
||||
}
|
||||
try!(write!(w, "</div>"));
|
||||
|
|
@ -1753,7 +1753,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
|||
<h2 id='required-methods'>Required Methods</h2>
|
||||
<div class='methods'>
|
||||
"));
|
||||
for m in required.iter() {
|
||||
for m in &required {
|
||||
try!(trait_item(w, *m));
|
||||
}
|
||||
try!(write!(w, "</div>"));
|
||||
|
|
@ -1763,7 +1763,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
|||
<h2 id='provided-methods'>Provided Methods</h2>
|
||||
<div class='methods'>
|
||||
"));
|
||||
for m in provided.iter() {
|
||||
for m in &provided {
|
||||
try!(trait_item(w, *m));
|
||||
}
|
||||
try!(write!(w, "</div>"));
|
||||
|
|
@ -1776,7 +1776,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
|||
"));
|
||||
match cache.implementors.get(&it.def_id) {
|
||||
Some(implementors) => {
|
||||
for i in implementors.iter() {
|
||||
for i in implementors {
|
||||
try!(writeln!(w, "<li>{}<code>impl{} {} for {}{}</code></li>",
|
||||
ConciseStability(&i.stability),
|
||||
i.generics, i.trait_, i.for_, WhereClause(&i.generics)));
|
||||
|
|
@ -1890,7 +1890,7 @@ fn item_enum(w: &mut fmt::Formatter, it: &clean::Item,
|
|||
try!(write!(w, " {{}}"));
|
||||
} else {
|
||||
try!(write!(w, " {{\n"));
|
||||
for v in e.variants.iter() {
|
||||
for v in &e.variants {
|
||||
try!(write!(w, " "));
|
||||
let name = v.name.as_ref().unwrap().as_slice();
|
||||
match v.inner {
|
||||
|
|
@ -1933,7 +1933,7 @@ fn item_enum(w: &mut fmt::Formatter, it: &clean::Item,
|
|||
try!(document(w, it));
|
||||
if e.variants.len() > 0 {
|
||||
try!(write!(w, "<h2 class='variants'>Variants</h2>\n<table>"));
|
||||
for variant in e.variants.iter() {
|
||||
for variant in &e.variants {
|
||||
try!(write!(w, "<tr><td id='variant.{name}'>{stab}<code>{name}</code></td><td>",
|
||||
stab = ConciseStability(&variant.stability),
|
||||
name = variant.name.as_ref().unwrap().as_slice()));
|
||||
|
|
@ -1996,7 +1996,7 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
|
|||
doctree::Plain => {
|
||||
try!(write!(w, " {{\n{}", tab));
|
||||
let mut fields_stripped = false;
|
||||
for field in fields.iter() {
|
||||
for field in fields {
|
||||
match field.inner {
|
||||
clean::StructFieldItem(clean::HiddenStructField) => {
|
||||
fields_stripped = true;
|
||||
|
|
@ -2049,7 +2049,7 @@ fn render_methods(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
|
|||
.partition(|i| i.impl_.trait_.is_none());
|
||||
if non_trait.len() > 0 {
|
||||
try!(write!(w, "<h2 id='methods'>Methods</h2>"));
|
||||
for i in non_trait.iter() {
|
||||
for i in &non_trait {
|
||||
try!(render_impl(w, i));
|
||||
}
|
||||
}
|
||||
|
|
@ -2058,13 +2058,13 @@ fn render_methods(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
|
|||
Implementations</h2>"));
|
||||
let (derived, manual): (Vec<_>, _) = traits.into_iter()
|
||||
.partition(|i| i.impl_.derived);
|
||||
for i in manual.iter() {
|
||||
for i in &manual {
|
||||
try!(render_impl(w, i));
|
||||
}
|
||||
if derived.len() > 0 {
|
||||
try!(write!(w, "<h3 id='derived_implementations'>Derived Implementations \
|
||||
</h3>"));
|
||||
for i in derived.iter() {
|
||||
for i in &derived {
|
||||
try!(render_impl(w, i));
|
||||
}
|
||||
}
|
||||
|
|
@ -2137,14 +2137,14 @@ fn render_impl(w: &mut fmt::Formatter, i: &Impl) -> fmt::Result {
|
|||
}
|
||||
|
||||
try!(write!(w, "<div class='impl-items'>"));
|
||||
for trait_item in i.impl_.items.iter() {
|
||||
for trait_item in &i.impl_.items {
|
||||
try!(doctraititem(w, trait_item, true));
|
||||
}
|
||||
|
||||
fn render_default_methods(w: &mut fmt::Formatter,
|
||||
t: &clean::Trait,
|
||||
i: &clean::Impl) -> fmt::Result {
|
||||
for trait_item in t.items.iter() {
|
||||
for trait_item in &t.items {
|
||||
let n = trait_item.item().name.clone();
|
||||
match i.items.iter().find(|m| { m.name == n }) {
|
||||
Some(..) => continue,
|
||||
|
|
@ -2209,7 +2209,7 @@ impl<'a> fmt::Display for Sidebar<'a> {
|
|||
None => return Ok(())
|
||||
};
|
||||
try!(write!(w, "<div class='block {}'><h2>{}</h2>", short, longty));
|
||||
for &NameDoc(ref name, ref doc) in items.iter() {
|
||||
for &NameDoc(ref name, ref doc) in items {
|
||||
let curty = shortty(cur).to_static_str();
|
||||
let class = if cur.name.as_ref().unwrap() == name &&
|
||||
short == curty { "current" } else { "" };
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ impl fmt::Debug for Toc {
|
|||
impl fmt::Display for Toc {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(write!(fmt, "<ul>"));
|
||||
for entry in self.entries.iter() {
|
||||
for entry in &self.entries {
|
||||
// recursively format this table of contents (the
|
||||
// `{children}` is the key).
|
||||
try!(write!(fmt,
|
||||
|
|
|
|||
|
|
@ -200,11 +200,11 @@ pub fn main_args(args: &[String]) -> int {
|
|||
|
||||
if matches.opt_strs("passes") == ["list"] {
|
||||
println!("Available passes for running rustdoc:");
|
||||
for &(name, _, description) in PASSES.iter() {
|
||||
for &(name, _, description) in PASSES {
|
||||
println!("{:>20} - {}", name, description);
|
||||
}
|
||||
println!("{}", "\nDefault passes for rustdoc:"); // FIXME: #9970
|
||||
for &name in DEFAULT_PASSES.iter() {
|
||||
for &name in DEFAULT_PASSES {
|
||||
println!("{:>20}", name);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -220,7 +220,7 @@ pub fn main_args(args: &[String]) -> int {
|
|||
let input = matches.free[0].as_slice();
|
||||
|
||||
let mut libs = SearchPaths::new();
|
||||
for s in matches.opt_strs("L").iter() {
|
||||
for s in &matches.opt_strs("L") {
|
||||
libs.add_path(s.as_slice());
|
||||
}
|
||||
let externs = match parse_externs(&matches) {
|
||||
|
|
@ -322,7 +322,7 @@ fn acquire_input(input: &str,
|
|||
/// error message.
|
||||
fn parse_externs(matches: &getopts::Matches) -> Result<core::Externs, String> {
|
||||
let mut externs = HashMap::new();
|
||||
for arg in matches.opt_strs("extern").iter() {
|
||||
for arg in &matches.opt_strs("extern") {
|
||||
let mut parts = arg.splitn(1, '=');
|
||||
let name = match parts.next() {
|
||||
Some(s) => s,
|
||||
|
|
@ -356,7 +356,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
|
|||
|
||||
// First, parse the crate and extract all relevant information.
|
||||
let mut paths = SearchPaths::new();
|
||||
for s in matches.opt_strs("L").iter() {
|
||||
for s in &matches.opt_strs("L") {
|
||||
paths.add_path(s.as_slice());
|
||||
}
|
||||
let cfgs = matches.opt_strs("cfg");
|
||||
|
|
@ -386,7 +386,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
|
|||
// with the passes which we are supposed to run.
|
||||
match krate.module.as_ref().unwrap().doc_list() {
|
||||
Some(nested) => {
|
||||
for inner in nested.iter() {
|
||||
for inner in nested {
|
||||
match *inner {
|
||||
clean::Word(ref x)
|
||||
if "no_default_passes" == *x => {
|
||||
|
|
@ -420,7 +420,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
|
|||
let path = matches.opt_str("plugin-path")
|
||||
.unwrap_or("/tmp/rustdoc/plugins".to_string());
|
||||
let mut pm = plugins::PluginManager::new(Path::new(path));
|
||||
for pass in passes.iter() {
|
||||
for pass in &passes {
|
||||
let plugin = match PASSES.iter()
|
||||
.position(|&(p, _, _)| {
|
||||
p == *pass
|
||||
|
|
@ -434,7 +434,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
|
|||
pm.add_plugin(plugin);
|
||||
}
|
||||
info!("loading plugins...");
|
||||
for pname in plugins.into_iter() {
|
||||
for pname in plugins {
|
||||
pm.load_plugin(pname);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches,
|
|||
output.set_extension("html");
|
||||
|
||||
let mut css = String::new();
|
||||
for name in matches.opt_strs("markdown-css").iter() {
|
||||
for name in &matches.opt_strs("markdown-css") {
|
||||
let s = format!("<link rel=\"stylesheet\" type=\"text/css\" href=\"{}\">\n", name);
|
||||
css.push_str(s.as_slice())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ pub fn unindent_comments(krate: clean::Crate) -> plugins::PluginResult {
|
|||
fn fold_item(&mut self, i: Item) -> Option<Item> {
|
||||
let mut i = i;
|
||||
let mut avec: Vec<clean::Attribute> = Vec::new();
|
||||
for attr in i.attrs.iter() {
|
||||
for attr in &i.attrs {
|
||||
match attr {
|
||||
&clean::NameValue(ref x, ref s)
|
||||
if "doc" == *x => {
|
||||
|
|
@ -280,7 +280,7 @@ pub fn collapse_docs(krate: clean::Crate) -> plugins::PluginResult {
|
|||
fn fold_item(&mut self, i: Item) -> Option<Item> {
|
||||
let mut docstr = String::new();
|
||||
let mut i = i;
|
||||
for attr in i.attrs.iter() {
|
||||
for attr in &i.attrs {
|
||||
match *attr {
|
||||
clean::NameValue(ref x, ref s)
|
||||
if "doc" == *x => {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ impl PluginManager {
|
|||
pub fn run_plugins(&self, krate: clean::Crate) -> (clean::Crate, Vec<PluginJson> ) {
|
||||
let mut out_json = Vec::new();
|
||||
let mut krate = krate;
|
||||
for &callback in self.callbacks.iter() {
|
||||
for &callback in &self.callbacks {
|
||||
let (c, res) = callback(krate);
|
||||
krate = c;
|
||||
out_json.push(res);
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
|||
om.vis = vis;
|
||||
om.stab = self.stability(id);
|
||||
om.id = id;
|
||||
for i in m.items.iter() {
|
||||
for i in &m.items {
|
||||
self.visit_item(&**i, None, &mut om);
|
||||
}
|
||||
om
|
||||
|
|
@ -211,7 +211,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
|||
if glob {
|
||||
match it.node {
|
||||
ast::ItemMod(ref m) => {
|
||||
for i in m.items.iter() {
|
||||
for i in &m.items {
|
||||
self.visit_item(&**i, None, om);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue