File tree 2 files changed +20
-7
lines changed
librustc/middle/typeck/check
2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -438,10 +438,9 @@ pub impl LookupContext {
438
438
439
439
let trait_methods = ty:: trait_methods ( tcx, init_trait_id) ;
440
440
let pos = {
441
- // FIXME #3453 can't use trait_methods.position
442
- match vec:: position ( * trait_methods,
443
- |m| ( m. self_ty != ast:: sty_static &&
444
- m. ident == self . m_name ) )
441
+ match trait_methods. position ( |m| {
442
+ m. self_ty != ast:: sty_static &&
443
+ m. ident == self . m_name } )
445
444
{
446
445
Some ( pos) => pos,
447
446
None => {
@@ -624,9 +623,7 @@ pub impl LookupContext {
624
623
}
625
624
626
625
let idx = {
627
- // FIXME #3453 can't use impl_info.methods.position
628
- match vec:: position ( impl_info. methods ,
629
- |m| m. ident == self . m_name ) {
626
+ match impl_info. methods . position ( |m| m. ident == self . m_name ) {
630
627
Some ( idx) => idx,
631
628
None => { return ; } // No method with the right name.
632
629
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ pub fn main ( ) {
12
+ let mut v = ~[ 1 , 2 , 3 ] ;
13
+ assert v. position ( |x| * x == 1 ) == Some ( 0 ) ;
14
+ assert v. position ( |x| * x == 3 ) == Some ( 2 ) ;
15
+ assert v. position ( |x| * x == 17 ) == None ;
16
+ }
You can’t perform that action at this time.
0 commit comments