Skip to content

Commit 641aec7

Browse files
committed
remove some method resolve workarounds
1 parent 28643d4 commit 641aec7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+118
-118
lines changed

src/libextra/getopts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ fn name_str(nm: &Name) -> ~str {
176176
}
177177

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

182182
/**

src/libextra/json.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ impl serialize::Decoder for Decoder {
950950
}
951951
ref json => fail!("invalid variant: %?", *json),
952952
};
953-
let idx = match names.iter().position_(|n| str::eq_slice(*n, name)) {
953+
let idx = match names.iter().position(|n| str::eq_slice(*n, name)) {
954954
Some(idx) => idx,
955955
None => fail!("Unknown variant name: %?", name),
956956
};

src/libextra/net/ip.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ pub mod v4 {
203203
}).collect();
204204
if parts.len() != 4 {
205205
Err(fmt!("'%s' doesn't have 4 parts", ip))
206-
} else if parts.iter().any_(|x| *x == 256u) {
206+
} else if parts.iter().any(|x| *x == 256u) {
207207
Err(fmt!("invalid octal in addr '%s'", ip))
208208
} else {
209209
Ok(Ipv4Rep {

src/libextra/net/url.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ fn get_authority(rawurl: &str) ->
522522
let host_is_end_plus_one: &fn() -> bool = || {
523523
let xs = ['?', '#', '/'];
524524
end+1 == len
525-
&& !xs.iter().any_(|x| *x == (rawurl[end] as char))
525+
&& !xs.iter().any(|x| *x == (rawurl[end] as char))
526526
};
527527

528528
// finish up

src/libextra/par.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ pub fn any<A:Copy + Send>(
136136
fn_factory: &fn() -> ~fn(&A) -> bool) -> bool {
137137
let mapped = map_slices(xs, || {
138138
let f = fn_factory();
139-
let result: ~fn(uint, &[A]) -> bool = |_, slice| slice.iter().any_(f);
139+
let result: ~fn(uint, &[A]) -> bool = |_, slice| slice.iter().any(f);
140140
result
141141
});
142-
mapped.iter().any_(|&x| x)
142+
mapped.iter().any(|&x| x)
143143
}

src/libextra/terminfo/parser/compiled.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
294294

295295
// Find the offset of the NUL we want to go to
296296
let nulpos = string_table.slice(offset as uint, string_table_bytes as uint)
297-
.iter().position_(|&b| b == 0);
297+
.iter().position(|&b| b == 0);
298298
match nulpos {
299299
Some(len) => {
300300
string_map.insert(name.to_owned(),

src/libextra/treemap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ mod test_treemap {
844844
for 90.times {
845845
let k = rng.gen();
846846
let v = rng.gen();
847-
if !ctrl.iter().any_(|x| x == &(k, v)) {
847+
if !ctrl.iter().any(|x| x == &(k, v)) {
848848
assert!(map.insert(k, v));
849849
ctrl.push((k, v));
850850
check_structure(&map);

src/librustc/front/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pub fn metas_in_cfg(cfg: &[@ast::meta_item],
194194

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

197-
cfg_metas.iter().any_(|cfg_meta| {
197+
cfg_metas.iter().any(|cfg_meta| {
198198
cfg_meta.iter().all(|cfg_mi| {
199199
match cfg_mi.node {
200200
ast::meta_list(s, ref it) if "not" == s

src/librustc/metadata/cstore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub fn get_used_crate_files(cstore: &CStore) -> ~[Path] {
102102
pub fn add_used_library(cstore: &mut CStore, lib: @str) -> bool {
103103
assert!(!lib.is_empty());
104104

105-
if cstore.used_libraries.iter().any_(|x| x == &lib) { return false; }
105+
if cstore.used_libraries.iter().any(|x| x == &lib) { return false; }
106106
cstore.used_libraries.push(lib);
107107
true
108108
}

src/librustc/middle/borrowck/move_data.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ impl FlowedMoveData {
506506
for self.dfcx_moves.each_bit_on_entry_frozen(id) |index| {
507507
let move = &self.move_data.moves[index];
508508
let moved_path = move.path;
509-
if base_indices.iter().any_(|x| x == &moved_path) {
509+
if base_indices.iter().any(|x| x == &moved_path) {
510510
// Scenario 1 or 2: `loan_path` or some base path of
511511
// `loan_path` was moved.
512512
if !f(move, self.move_data.path(moved_path).loan_path) {
@@ -535,7 +535,7 @@ impl FlowedMoveData {
535535
-> bool {
536536
//! True if `id` is the id of the LHS of an assignment
537537
538-
self.move_data.assignee_ids.iter().any_(|x| x == &id)
538+
self.move_data.assignee_ids.iter().any(|x| x == &id)
539539
}
540540

541541
pub fn each_assignment_of(&self,

src/librustc/middle/check_const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ pub fn check_item_recursion(sess: Session,
224224
(visitor.visit_item)(it, (env, visitor));
225225

226226
fn visit_item(it: @item, (env, v): (env, visit::vt<env>)) {
227-
if env.idstack.iter().any_(|x| x == &(it.id)) {
227+
if env.idstack.iter().any(|x| x == &(it.id)) {
228228
env.sess.span_fatal(env.root_it.span, "recursive constant");
229229
}
230230
env.idstack.push(it.id);

src/librustc/middle/check_match.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ pub fn missing_ctor(cx: &MatchCheckCtxt,
371371
let variants = ty::enum_variants(cx.tcx, eid);
372372
if found.len() != (*variants).len() {
373373
for (*variants).iter().advance |v| {
374-
if !found.iter().any_(|x| x == &(variant(v.id))) {
374+
if !found.iter().any(|x| x == &(variant(v.id))) {
375375
return Some(variant(v.id));
376376
}
377377
}
@@ -805,13 +805,13 @@ pub fn is_refutable(cx: &MatchCheckCtxt, pat: &pat) -> bool {
805805
}
806806
pat_lit(_) | pat_range(_, _) => { true }
807807
pat_struct(_, ref fields, _) => {
808-
fields.iter().any_(|f| is_refutable(cx, f.pat))
808+
fields.iter().any(|f| is_refutable(cx, f.pat))
809809
}
810810
pat_tup(ref elts) => {
811-
elts.iter().any_(|elt| is_refutable(cx, *elt))
811+
elts.iter().any(|elt| is_refutable(cx, *elt))
812812
}
813813
pat_enum(_, Some(ref args)) => {
814-
args.iter().any_(|a| is_refutable(cx, *a))
814+
args.iter().any(|a| is_refutable(cx, *a))
815815
}
816816
pat_enum(_,_) => { false }
817817
pat_vec(*) => { true }

src/librustc/middle/dataflow.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,14 @@ impl<O:DataFlowOperator+Copy+'static> DataFlowContext<O> {
341341
let entry_str = bits_to_str(on_entry);
342342

343343
let gens = self.gens.slice(start, end);
344-
let gens_str = if gens.iter().any_(|&u| u != 0) {
344+
let gens_str = if gens.iter().any(|&u| u != 0) {
345345
fmt!(" gen: %s", bits_to_str(gens))
346346
} else {
347347
~""
348348
};
349349

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

645645
// is this a return from a `for`-loop closure?
646-
match loop_scopes.iter().position_(|s| s.loop_kind == ForLoop) {
646+
match loop_scopes.iter().position(|s| s.loop_kind == ForLoop) {
647647
Some(i) => {
648648
// if so, add the in_out bits to the state
649649
// upon exit. Remember that we cannot count
@@ -916,7 +916,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
916916
Some(_) => {
917917
match self.tcx().def_map.find(&expr.id) {
918918
Some(&ast::def_label(loop_id)) => {
919-
match loop_scopes.iter().position_(|l| l.loop_id == loop_id) {
919+
match loop_scopes.iter().position(|l| l.loop_id == loop_id) {
920920
Some(i) => i,
921921
None => {
922922
self.tcx().sess.span_bug(

src/librustc/middle/kind.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ pub fn check_cast_for_escaping_regions(
536536
// Check, based on the region associated with the trait, whether it can
537537
// possibly escape the enclosing fn item (note that all type parameters
538538
// must have been declared on the enclosing fn item).
539-
if target_regions.iter().any_(|r| is_re_scope(*r)) {
539+
if target_regions.iter().any(|r| is_re_scope(*r)) {
540540
return; /* case (1) */
541541
}
542542

@@ -551,7 +551,7 @@ pub fn check_cast_for_escaping_regions(
551551
|_r| {
552552
// FIXME(#5723) --- turn this check on once &Objects are usable
553553
//
554-
// if !target_regions.iter().any_(|t_r| is_subregion_of(cx, *t_r, r)) {
554+
// if !target_regions.iter().any(|t_r| is_subregion_of(cx, *t_r, r)) {
555555
// cx.tcx.sess.span_err(
556556
// source.span,
557557
// fmt!("source contains borrowed pointer with lifetime \
@@ -565,7 +565,7 @@ pub fn check_cast_for_escaping_regions(
565565
|ty| {
566566
match ty::get(ty).sty {
567567
ty::ty_param(source_param) => {
568-
if target_params.iter().any_(|x| x == &source_param) {
568+
if target_params.iter().any(|x| x == &source_param) {
569569
/* case (2) */
570570
} else {
571571
check_durable(cx.tcx, ty, source.span); /* case (3) */

src/librustc/middle/lint.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ fn check_item_non_uppercase_statics(cx: &Context, it: &ast::item) {
898898
// check for lowercase letters rather than non-uppercase
899899
// ones (some scripts don't have a concept of
900900
// upper/lowercase)
901-
if s.iter().any_(|c| c.is_lowercase()) {
901+
if s.iter().any(|c| c.is_lowercase()) {
902902
cx.span_lint(non_uppercase_statics, it.span,
903903
"static constant should have an uppercase identifier");
904904
}
@@ -1038,7 +1038,7 @@ fn lint_missing_doc() -> visit::vt<@mut Context> {
10381038
// If we have doc(hidden), nothing to do
10391039
if cx.doc_hidden { return }
10401040
// If we're documented, nothing to do
1041-
if attrs.iter().any_(|a| a.node.is_sugared_doc) { return }
1041+
if attrs.iter().any(|a| a.node.is_sugared_doc) { return }
10421042

10431043
// otherwise, warn!
10441044
cx.span_lint(missing_doc, sp, msg);

src/librustc/middle/moves.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,8 @@ impl VisitContext {
390390
// any fields which (1) were not explicitly
391391
// specified and (2) have a type that
392392
// moves-by-default:
393-
let consume_with = with_fields.iter().any_(|tf| {
394-
!fields.iter().any_(|f| f.node.ident == tf.ident) &&
393+
let consume_with = with_fields.iter().any(|tf| {
394+
!fields.iter().any(|f| f.node.ident == tf.ident) &&
395395
ty::type_moves_by_default(self.tcx, tf.mt.ty)
396396
});
397397

src/librustc/middle/privacy.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
259259
method_id.node);
260260
if is_private &&
261261
(container_id.crate != local_crate ||
262-
!privileged_items.iter().any_(|x| x == &(container_id.node))) {
262+
!privileged_items.iter().any(|x| x == &(container_id.node))) {
263263
tcx.sess.span_err(span,
264264
fmt!("method `%s` is private",
265265
token::ident_to_str(name)));
@@ -287,7 +287,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
287287
def_fn(def_id, _) => {
288288
if def_id.crate == local_crate {
289289
if local_item_is_private(span, def_id.node) &&
290-
!privileged_items.iter().any_(|x| x == &def_id.node) {
290+
!privileged_items.iter().any(|x| x == &def_id.node) {
291291
tcx.sess.span_err(span,
292292
fmt!("function `%s` is private",
293293
token::ident_to_str(path.idents.last())));
@@ -332,7 +332,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
332332
provided(method)
333333
if method.vis == private &&
334334
!privileged_items.iter()
335-
.any_(|x| x == &(trait_id.node)) => {
335+
.any(|x| x == &(trait_id.node)) => {
336336
tcx.sess.span_err(span,
337337
fmt!("method `%s` is private",
338338
token::ident_to_str(&method
@@ -417,7 +417,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
417417
base))).sty {
418418
ty_struct(id, _)
419419
if id.crate != local_crate || !privileged_items.iter()
420-
.any_(|x| x == &(id.node)) => {
420+
.any(|x| x == &(id.node)) => {
421421
debug!("(privacy checking) checking field access");
422422
check_field(expr.span, id, ident);
423423
}
@@ -430,7 +430,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
430430
base))).sty {
431431
ty_struct(id, _)
432432
if id.crate != local_crate ||
433-
!privileged_items.iter().any_(|x| x == &(id.node)) => {
433+
!privileged_items.iter().any(|x| x == &(id.node)) => {
434434
match method_map.find(&expr.id) {
435435
None => {
436436
tcx.sess.span_bug(expr.span,
@@ -456,7 +456,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
456456
match ty::get(ty::expr_ty(tcx, expr)).sty {
457457
ty_struct(id, _) => {
458458
if id.crate != local_crate ||
459-
!privileged_items.iter().any_(|x| x == &(id.node)) {
459+
!privileged_items.iter().any(|x| x == &(id.node)) {
460460
for (*fields).iter().advance |field| {
461461
debug!("(privacy checking) checking \
462462
field in struct literal");
@@ -467,7 +467,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
467467
}
468468
ty_enum(id, _) => {
469469
if id.crate != local_crate ||
470-
!privileged_items.iter().any_(|x| x == &(id.node)) {
470+
!privileged_items.iter().any(|x| x == &(id.node)) {
471471
match tcx.def_map.get_copy(&expr.id) {
472472
def_variant(_, variant_id) => {
473473
for (*fields).iter().advance |field| {
@@ -504,7 +504,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
504504
match ty::get(ty::expr_ty(tcx, operand)).sty {
505505
ty_enum(id, _) => {
506506
if id.crate != local_crate ||
507-
!privileged_items.iter().any_(|x| x == &(id.node)) {
507+
!privileged_items.iter().any(|x| x == &(id.node)) {
508508
check_variant(expr.span, id);
509509
}
510510
}
@@ -522,7 +522,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
522522
match ty::get(ty::pat_ty(tcx, pattern)).sty {
523523
ty_struct(id, _) => {
524524
if id.crate != local_crate ||
525-
!privileged_items.iter().any_(|x| x == &(id.node)) {
525+
!privileged_items.iter().any(|x| x == &(id.node)) {
526526
for fields.iter().advance |field| {
527527
debug!("(privacy checking) checking \
528528
struct pattern");
@@ -533,7 +533,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
533533
}
534534
ty_enum(enum_id, _) => {
535535
if enum_id.crate != local_crate ||
536-
!privileged_items.iter().any_(|x| x == &enum_id.node) {
536+
!privileged_items.iter().any(|x| x == &enum_id.node) {
537537
match tcx.def_map.find(&pattern.id) {
538538
Some(&def_variant(_, variant_id)) => {
539539
for fields.iter().advance |field| {

src/librustc/middle/region.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl RegionMaps {
7878
pub fn relate_free_regions(&mut self, sub: FreeRegion, sup: FreeRegion) {
7979
match self.free_region_map.find_mut(&sub) {
8080
Some(sups) => {
81-
if !sups.iter().any_(|x| x == &sup) {
81+
if !sups.iter().any(|x| x == &sup) {
8282
sups.push(sup);
8383
}
8484
return;
@@ -202,7 +202,7 @@ impl RegionMaps {
202202
return true;
203203
}
204204

205-
if !queue.iter().any_(|x| x == parent) {
205+
if !queue.iter().any(|x| x == parent) {
206206
queue.push(*parent);
207207
}
208208
}
@@ -612,7 +612,7 @@ impl DetermineRpCtxt {
612612
ambient_variance: self.ambient_variance,
613613
id: self.item_id
614614
};
615-
if !vec.iter().any_(|x| x == &dep) { vec.push(dep); }
615+
if !vec.iter().any(|x| x == &dep) { vec.push(dep); }
616616
}
617617

618618
// Determines whether a reference to a region that appears in the

src/librustc/middle/trans/_match.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ pub fn enter_region<'r>(bcx: block,
796796
pub fn get_options(bcx: block, m: &[@Match], col: uint) -> ~[Opt] {
797797
let ccx = bcx.ccx();
798798
fn add_to_set(tcx: ty::ctxt, set: &mut ~[Opt], val: Opt) {
799-
if set.iter().any_(|l| opt_eq(tcx, l, &val)) {return;}
799+
if set.iter().any(|l| opt_eq(tcx, l, &val)) {return;}
800800
set.push(val);
801801
}
802802

@@ -963,7 +963,7 @@ pub fn collect_record_or_struct_fields(bcx: block,
963963
fn extend(idents: &mut ~[ast::ident], field_pats: &[ast::field_pat]) {
964964
for field_pats.iter().advance |field_pat| {
965965
let field_ident = field_pat.ident;
966-
if !idents.iter().any_(|x| *x == field_ident) {
966+
if !idents.iter().any(|x| *x == field_ident) {
967967
idents.push(field_ident);
968968
}
969969
}
@@ -974,7 +974,7 @@ pub fn pats_require_rooting(bcx: block,
974974
m: &[@Match],
975975
col: uint)
976976
-> bool {
977-
do m.iter().any_ |br| {
977+
do m.iter().any |br| {
978978
let pat_id = br.pats[col].id;
979979
let key = root_map_key {id: pat_id, derefs: 0u };
980980
bcx.ccx().maps.root_map.contains_key(&key)
@@ -1003,7 +1003,7 @@ pub fn root_pats_as_necessary(mut bcx: block,
10031003
// matches may be wildcards like _ or identifiers).
10041004
macro_rules! any_pat (
10051005
($m:expr, $pattern:pat) => (
1006-
do ($m).iter().any_ |br| {
1006+
do ($m).iter().any |br| {
10071007
match br.pats[col].node {
10081008
$pattern => true,
10091009
_ => false
@@ -1029,7 +1029,7 @@ pub fn any_tup_pat(m: &[@Match], col: uint) -> bool {
10291029
}
10301030

10311031
pub fn any_tuple_struct_pat(bcx: block, m: &[@Match], col: uint) -> bool {
1032-
do m.iter().any_ |br| {
1032+
do m.iter().any |br| {
10331033
let pat = br.pats[col];
10341034
match pat.node {
10351035
ast::pat_enum(_, Some(_)) => {

src/librustc/middle/trans/adt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ fn represent_type_uncached(cx: &mut CrateContext, t: ty::t) -> Repr {
147147
mk_struct(cx, self.tys, false).size == 0
148148
}
149149
fn find_ptr(&self) -> Option<uint> {
150-
self.tys.iter().position_(|&ty| mono_data_classify(ty) == MonoNonNull)
150+
self.tys.iter().position(|&ty| mono_data_classify(ty) == MonoNonNull)
151151
}
152152
}
153153

0 commit comments

Comments
 (0)