Skip to content

remove some method resolve workarounds #7595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libextra/getopts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ fn name_str(nm: &Name) -> ~str {
}

fn find_opt(opts: &[Opt], nm: Name) -> Option<uint> {
opts.iter().position_(|opt| opt.name == nm)
opts.iter().position(|opt| opt.name == nm)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ impl serialize::Decoder for Decoder {
}
ref json => fail!("invalid variant: %?", *json),
};
let idx = match names.iter().position_(|n| str::eq_slice(*n, name)) {
let idx = match names.iter().position(|n| str::eq_slice(*n, name)) {
Some(idx) => idx,
None => fail!("Unknown variant name: %?", name),
};
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/net/ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub mod v4 {
}).collect();
if parts.len() != 4 {
Err(fmt!("'%s' doesn't have 4 parts", ip))
} else if parts.iter().any_(|x| *x == 256u) {
} else if parts.iter().any(|x| *x == 256u) {
Err(fmt!("invalid octal in addr '%s'", ip))
} else {
Ok(Ipv4Rep {
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/net/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ fn get_authority(rawurl: &str) ->
let host_is_end_plus_one: &fn() -> bool = || {
let xs = ['?', '#', '/'];
end+1 == len
&& !xs.iter().any_(|x| *x == (rawurl[end] as char))
&& !xs.iter().any(|x| *x == (rawurl[end] as char))
};

// finish up
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/par.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ pub fn any<A:Copy + Send>(
fn_factory: &fn() -> ~fn(&A) -> bool) -> bool {
let mapped = map_slices(xs, || {
let f = fn_factory();
let result: ~fn(uint, &[A]) -> bool = |_, slice| slice.iter().any_(f);
let result: ~fn(uint, &[A]) -> bool = |_, slice| slice.iter().any(f);
result
});
mapped.iter().any_(|&x| x)
mapped.iter().any(|&x| x)
}
2 changes: 1 addition & 1 deletion src/libextra/terminfo/parser/compiled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {

// Find the offset of the NUL we want to go to
let nulpos = string_table.slice(offset as uint, string_table_bytes as uint)
.iter().position_(|&b| b == 0);
.iter().position(|&b| b == 0);
match nulpos {
Some(len) => {
string_map.insert(name.to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/treemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ mod test_treemap {
for 90.times {
let k = rng.gen();
let v = rng.gen();
if !ctrl.iter().any_(|x| x == &(k, v)) {
if !ctrl.iter().any(|x| x == &(k, v)) {
assert!(map.insert(k, v));
ctrl.push((k, v));
check_structure(&map);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/front/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub fn metas_in_cfg(cfg: &[@ast::meta_item],

if cfg_metas.iter().all(|c| c.is_empty()) { return true; }

cfg_metas.iter().any_(|cfg_meta| {
cfg_metas.iter().any(|cfg_meta| {
cfg_meta.iter().all(|cfg_mi| {
match cfg_mi.node {
ast::meta_list(s, ref it) if "not" == s
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub fn get_used_crate_files(cstore: &CStore) -> ~[Path] {
pub fn add_used_library(cstore: &mut CStore, lib: @str) -> bool {
assert!(!lib.is_empty());

if cstore.used_libraries.iter().any_(|x| x == &lib) { return false; }
if cstore.used_libraries.iter().any(|x| x == &lib) { return false; }
cstore.used_libraries.push(lib);
true
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/borrowck/move_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ impl FlowedMoveData {
for self.dfcx_moves.each_bit_on_entry_frozen(id) |index| {
let move = &self.move_data.moves[index];
let moved_path = move.path;
if base_indices.iter().any_(|x| x == &moved_path) {
if base_indices.iter().any(|x| x == &moved_path) {
// Scenario 1 or 2: `loan_path` or some base path of
// `loan_path` was moved.
if !f(move, self.move_data.path(moved_path).loan_path) {
Expand Down Expand Up @@ -535,7 +535,7 @@ impl FlowedMoveData {
-> bool {
//! True if `id` is the id of the LHS of an assignment

self.move_data.assignee_ids.iter().any_(|x| x == &id)
self.move_data.assignee_ids.iter().any(|x| x == &id)
}

pub fn each_assignment_of(&self,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/check_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ pub fn check_item_recursion(sess: Session,
(visitor.visit_item)(it, (env, visitor));

fn visit_item(it: @item, (env, v): (env, visit::vt<env>)) {
if env.idstack.iter().any_(|x| x == &(it.id)) {
if env.idstack.iter().any(|x| x == &(it.id)) {
env.sess.span_fatal(env.root_it.span, "recursive constant");
}
env.idstack.push(it.id);
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ pub fn missing_ctor(cx: &MatchCheckCtxt,
let variants = ty::enum_variants(cx.tcx, eid);
if found.len() != (*variants).len() {
for (*variants).iter().advance |v| {
if !found.iter().any_(|x| x == &(variant(v.id))) {
if !found.iter().any(|x| x == &(variant(v.id))) {
return Some(variant(v.id));
}
}
Expand Down Expand Up @@ -805,13 +805,13 @@ pub fn is_refutable(cx: &MatchCheckCtxt, pat: &pat) -> bool {
}
pat_lit(_) | pat_range(_, _) => { true }
pat_struct(_, ref fields, _) => {
fields.iter().any_(|f| is_refutable(cx, f.pat))
fields.iter().any(|f| is_refutable(cx, f.pat))
}
pat_tup(ref elts) => {
elts.iter().any_(|elt| is_refutable(cx, *elt))
elts.iter().any(|elt| is_refutable(cx, *elt))
}
pat_enum(_, Some(ref args)) => {
args.iter().any_(|a| is_refutable(cx, *a))
args.iter().any(|a| is_refutable(cx, *a))
}
pat_enum(_,_) => { false }
pat_vec(*) => { true }
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,14 @@ impl<O:DataFlowOperator+Copy+'static> DataFlowContext<O> {
let entry_str = bits_to_str(on_entry);

let gens = self.gens.slice(start, end);
let gens_str = if gens.iter().any_(|&u| u != 0) {
let gens_str = if gens.iter().any(|&u| u != 0) {
fmt!(" gen: %s", bits_to_str(gens))
} else {
~""
};

let kills = self.kills.slice(start, end);
let kills_str = if kills.iter().any_(|&u| u != 0) {
let kills_str = if kills.iter().any(|&u| u != 0) {
fmt!(" kill: %s", bits_to_str(kills))
} else {
~""
Expand Down Expand Up @@ -643,7 +643,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
self.walk_opt_expr(o_e, in_out, loop_scopes);

// is this a return from a `for`-loop closure?
match loop_scopes.iter().position_(|s| s.loop_kind == ForLoop) {
match loop_scopes.iter().position(|s| s.loop_kind == ForLoop) {
Some(i) => {
// if so, add the in_out bits to the state
// upon exit. Remember that we cannot count
Expand Down Expand Up @@ -916,7 +916,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
Some(_) => {
match self.tcx().def_map.find(&expr.id) {
Some(&ast::def_label(loop_id)) => {
match loop_scopes.iter().position_(|l| l.loop_id == loop_id) {
match loop_scopes.iter().position(|l| l.loop_id == loop_id) {
Some(i) => i,
None => {
self.tcx().sess.span_bug(
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ pub fn check_cast_for_escaping_regions(
// Check, based on the region associated with the trait, whether it can
// possibly escape the enclosing fn item (note that all type parameters
// must have been declared on the enclosing fn item).
if target_regions.iter().any_(|r| is_re_scope(*r)) {
if target_regions.iter().any(|r| is_re_scope(*r)) {
return; /* case (1) */
}

Expand All @@ -551,7 +551,7 @@ pub fn check_cast_for_escaping_regions(
|_r| {
// FIXME(#5723) --- turn this check on once &Objects are usable
//
// if !target_regions.iter().any_(|t_r| is_subregion_of(cx, *t_r, r)) {
// if !target_regions.iter().any(|t_r| is_subregion_of(cx, *t_r, r)) {
// cx.tcx.sess.span_err(
// source.span,
// fmt!("source contains borrowed pointer with lifetime \
Expand All @@ -565,7 +565,7 @@ pub fn check_cast_for_escaping_regions(
|ty| {
match ty::get(ty).sty {
ty::ty_param(source_param) => {
if target_params.iter().any_(|x| x == &source_param) {
if target_params.iter().any(|x| x == &source_param) {
/* case (2) */
} else {
check_durable(cx.tcx, ty, source.span); /* case (3) */
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ fn check_item_non_uppercase_statics(cx: &Context, it: &ast::item) {
// check for lowercase letters rather than non-uppercase
// ones (some scripts don't have a concept of
// upper/lowercase)
if s.iter().any_(|c| c.is_lowercase()) {
if s.iter().any(|c| c.is_lowercase()) {
cx.span_lint(non_uppercase_statics, it.span,
"static constant should have an uppercase identifier");
}
Expand Down Expand Up @@ -1038,7 +1038,7 @@ fn lint_missing_doc() -> visit::vt<@mut Context> {
// If we have doc(hidden), nothing to do
if cx.doc_hidden { return }
// If we're documented, nothing to do
if attrs.iter().any_(|a| a.node.is_sugared_doc) { return }
if attrs.iter().any(|a| a.node.is_sugared_doc) { return }

// otherwise, warn!
cx.span_lint(missing_doc, sp, msg);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/moves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ impl VisitContext {
// any fields which (1) were not explicitly
// specified and (2) have a type that
// moves-by-default:
let consume_with = with_fields.iter().any_(|tf| {
!fields.iter().any_(|f| f.node.ident == tf.ident) &&
let consume_with = with_fields.iter().any(|tf| {
!fields.iter().any(|f| f.node.ident == tf.ident) &&
ty::type_moves_by_default(self.tcx, tf.mt.ty)
});

Expand Down
20 changes: 10 additions & 10 deletions src/librustc/middle/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
method_id.node);
if is_private &&
(container_id.crate != local_crate ||
!privileged_items.iter().any_(|x| x == &(container_id.node))) {
!privileged_items.iter().any(|x| x == &(container_id.node))) {
tcx.sess.span_err(span,
fmt!("method `%s` is private",
token::ident_to_str(name)));
Expand Down Expand Up @@ -287,7 +287,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
def_fn(def_id, _) => {
if def_id.crate == local_crate {
if local_item_is_private(span, def_id.node) &&
!privileged_items.iter().any_(|x| x == &def_id.node) {
!privileged_items.iter().any(|x| x == &def_id.node) {
tcx.sess.span_err(span,
fmt!("function `%s` is private",
token::ident_to_str(path.idents.last())));
Expand Down Expand Up @@ -332,7 +332,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
provided(method)
if method.vis == private &&
!privileged_items.iter()
.any_(|x| x == &(trait_id.node)) => {
.any(|x| x == &(trait_id.node)) => {
tcx.sess.span_err(span,
fmt!("method `%s` is private",
token::ident_to_str(&method
Expand Down Expand Up @@ -417,7 +417,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
base))).sty {
ty_struct(id, _)
if id.crate != local_crate || !privileged_items.iter()
.any_(|x| x == &(id.node)) => {
.any(|x| x == &(id.node)) => {
debug!("(privacy checking) checking field access");
check_field(expr.span, id, ident);
}
Expand All @@ -430,7 +430,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
base))).sty {
ty_struct(id, _)
if id.crate != local_crate ||
!privileged_items.iter().any_(|x| x == &(id.node)) => {
!privileged_items.iter().any(|x| x == &(id.node)) => {
match method_map.find(&expr.id) {
None => {
tcx.sess.span_bug(expr.span,
Expand All @@ -456,7 +456,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
match ty::get(ty::expr_ty(tcx, expr)).sty {
ty_struct(id, _) => {
if id.crate != local_crate ||
!privileged_items.iter().any_(|x| x == &(id.node)) {
!privileged_items.iter().any(|x| x == &(id.node)) {
for (*fields).iter().advance |field| {
debug!("(privacy checking) checking \
field in struct literal");
Expand All @@ -467,7 +467,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
}
ty_enum(id, _) => {
if id.crate != local_crate ||
!privileged_items.iter().any_(|x| x == &(id.node)) {
!privileged_items.iter().any(|x| x == &(id.node)) {
match tcx.def_map.get_copy(&expr.id) {
def_variant(_, variant_id) => {
for (*fields).iter().advance |field| {
Expand Down Expand Up @@ -504,7 +504,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
match ty::get(ty::expr_ty(tcx, operand)).sty {
ty_enum(id, _) => {
if id.crate != local_crate ||
!privileged_items.iter().any_(|x| x == &(id.node)) {
!privileged_items.iter().any(|x| x == &(id.node)) {
check_variant(expr.span, id);
}
}
Expand All @@ -522,7 +522,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
match ty::get(ty::pat_ty(tcx, pattern)).sty {
ty_struct(id, _) => {
if id.crate != local_crate ||
!privileged_items.iter().any_(|x| x == &(id.node)) {
!privileged_items.iter().any(|x| x == &(id.node)) {
for fields.iter().advance |field| {
debug!("(privacy checking) checking \
struct pattern");
Expand All @@ -533,7 +533,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
}
ty_enum(enum_id, _) => {
if enum_id.crate != local_crate ||
!privileged_items.iter().any_(|x| x == &enum_id.node) {
!privileged_items.iter().any(|x| x == &enum_id.node) {
match tcx.def_map.find(&pattern.id) {
Some(&def_variant(_, variant_id)) => {
for fields.iter().advance |field| {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl RegionMaps {
pub fn relate_free_regions(&mut self, sub: FreeRegion, sup: FreeRegion) {
match self.free_region_map.find_mut(&sub) {
Some(sups) => {
if !sups.iter().any_(|x| x == &sup) {
if !sups.iter().any(|x| x == &sup) {
sups.push(sup);
}
return;
Expand Down Expand Up @@ -202,7 +202,7 @@ impl RegionMaps {
return true;
}

if !queue.iter().any_(|x| x == parent) {
if !queue.iter().any(|x| x == parent) {
queue.push(*parent);
}
}
Expand Down Expand Up @@ -612,7 +612,7 @@ impl DetermineRpCtxt {
ambient_variance: self.ambient_variance,
id: self.item_id
};
if !vec.iter().any_(|x| x == &dep) { vec.push(dep); }
if !vec.iter().any(|x| x == &dep) { vec.push(dep); }
}

// Determines whether a reference to a region that appears in the
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/middle/trans/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ pub fn enter_region<'r>(bcx: block,
pub fn get_options(bcx: block, m: &[@Match], col: uint) -> ~[Opt] {
let ccx = bcx.ccx();
fn add_to_set(tcx: ty::ctxt, set: &mut ~[Opt], val: Opt) {
if set.iter().any_(|l| opt_eq(tcx, l, &val)) {return;}
if set.iter().any(|l| opt_eq(tcx, l, &val)) {return;}
set.push(val);
}

Expand Down Expand Up @@ -963,7 +963,7 @@ pub fn collect_record_or_struct_fields(bcx: block,
fn extend(idents: &mut ~[ast::ident], field_pats: &[ast::field_pat]) {
for field_pats.iter().advance |field_pat| {
let field_ident = field_pat.ident;
if !idents.iter().any_(|x| *x == field_ident) {
if !idents.iter().any(|x| *x == field_ident) {
idents.push(field_ident);
}
}
Expand All @@ -974,7 +974,7 @@ pub fn pats_require_rooting(bcx: block,
m: &[@Match],
col: uint)
-> bool {
do m.iter().any_ |br| {
do m.iter().any |br| {
let pat_id = br.pats[col].id;
let key = root_map_key {id: pat_id, derefs: 0u };
bcx.ccx().maps.root_map.contains_key(&key)
Expand Down Expand Up @@ -1003,7 +1003,7 @@ pub fn root_pats_as_necessary(mut bcx: block,
// matches may be wildcards like _ or identifiers).
macro_rules! any_pat (
($m:expr, $pattern:pat) => (
do ($m).iter().any_ |br| {
do ($m).iter().any |br| {
match br.pats[col].node {
$pattern => true,
_ => false
Expand All @@ -1029,7 +1029,7 @@ pub fn any_tup_pat(m: &[@Match], col: uint) -> bool {
}

pub fn any_tuple_struct_pat(bcx: block, m: &[@Match], col: uint) -> bool {
do m.iter().any_ |br| {
do m.iter().any |br| {
let pat = br.pats[col];
match pat.node {
ast::pat_enum(_, Some(_)) => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/adt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ fn represent_type_uncached(cx: &mut CrateContext, t: ty::t) -> Repr {
mk_struct(cx, self.tys, false).size == 0
}
fn find_ptr(&self) -> Option<uint> {
self.tys.iter().position_(|&ty| mono_data_classify(ty) == MonoNonNull)
self.tys.iter().position(|&ty| mono_data_classify(ty) == MonoNonNull)
}
}

Expand Down
Loading