let mut fd = -1;
let mut offset = 0;
let mut custom_flags = false;
- let len = round_up(min_len, page_size());
+ let len = round_up(min_len, env::page_size());
- for &o in options.iter() {
+ for &o in options {
match o {
MapReadable => { prot |= libc::PROT_READ; },
MapWritable => { prot |= libc::PROT_WRITE; },
let mut executable = false;
let mut handle: HANDLE = libc::INVALID_HANDLE_VALUE;
let mut offset: uint = 0;
- let len = round_up(min_len, page_size());
+ let len = round_up(min_len, env::page_size());
- for &o in options.iter() {
+ for &o in options {
match o {
MapReadable => { readable = true; },
MapWritable => { writable = true; },
}
}
let mut ret_val = HashMap::new();
- let mut idx = 0us;
+ let mut idx = 0;
- for m in ms.iter() { n_rec(p_s, m, res, &mut ret_val, &mut idx) }
+ for m in ms { n_rec(p_s, m, res, &mut ret_val, &mut idx) }
ret_val
}
/* error messages here could be improved with links to orig. rules */
if token_name_eq(&tok, &token::Eof) {
- if eof_eis.len() == 1us {
+ if eof_eis.len() == 1 {
let mut v = Vec::new();
- for dv in (&mut eof_eis[0]).matches.iter_mut() {
+ for dv in &mut (&mut eof_eis[0]).matches {
v.push(dv.pop().unwrap());
}
return Success(nameize(sess, ms, &v[]));
pub fn commasep<T, F>(&mut self, b: Breaks, elts: &[T], mut op: F) -> IoResult<()> where
F: FnMut(&mut State, &T) -> IoResult<()>,
{
- try!(self.rbox(0us, b));
+ try!(self.rbox(0, b));
let mut first = true;
- for elt in elts.iter() {
+ for elt in elts {
if first { first = false; } else { try!(self.word_space(",")); }
try!(op(self, elt));
}
F: FnMut(&mut State, &T) -> IoResult<()>,
G: FnMut(&T) -> codemap::Span,
{
- try!(self.rbox(0us, b));
+ try!(self.rbox(0, b));
let len = elts.len();
- let mut i = 0us;
+ let mut i = 0;
- for elt in elts.iter() {
+ for elt in elts {
try!(self.maybe_print_comment(get_span(elt).hi));
try!(op(self, elt));
- i += 1us;
+ i += 1;
if i < len {
try!(word(&mut self.s, ","));
try!(self.maybe_print_trailing_comment(get_span(elt),
pub fn print_outer_attributes(&mut self,
attrs: &[ast::Attribute]) -> IoResult<()> {
- let mut count = 0us;
+ let mut count = 0;
- for attr in attrs.iter() {
+ for attr in attrs {
match attr.node.style {
ast::AttrOuter => {
try!(self.print_attribute(attr));
pub fn print_inner_attributes(&mut self,
attrs: &[ast::Attribute]) -> IoResult<()> {
- let mut count = 0us;
+ let mut count = 0;
- for attr in attrs.iter() {
+ for attr in attrs {
match attr.node.style {
ast::AttrInner => {
try!(self.print_attribute(attr));
try!(space(&mut self.s));
}
try!(self.cbox(indent_unit));
- try!(self.ibox(0us));
+ try!(self.ibox(0));
try!(self.print_outer_attributes(&arm.attrs[]));
let mut first = true;
- for p in arm.pats.iter() {
+ for p in &arm.pats {
if first {
first = false;
} else {
-> IoResult<()> {
// It is unfortunate to duplicate the commasep logic, but we want the
// self type and the args all in the same box.
- try!(self.rbox(0us, Inconsistent));
+ try!(self.rbox(0, Inconsistent));
let mut first = true;
- for &explicit_self in opt_explicit_self.iter() {
+ if let Some(explicit_self) = opt_explicit_self {
let m = match explicit_self {
&ast::SelfStatic => ast::MutImmutable,
_ => match decl.inputs[0].pat.node {
try!(word(&mut self.s, &cmnt.lines[0][]));
hardbreak(&mut self.s)
} else {
- try!(self.ibox(0us));
+ try!(self.ibox(0));
- for line in cmnt.lines.iter() {
+ for line in &cmnt.lines {
if !line.is_empty() {
try!(word(&mut self.s, &line[]));
}