File tree Expand file tree Collapse file tree 12 files changed +39
-36
lines changed Expand file tree Collapse file tree 12 files changed +39
-36
lines changed Original file line number Diff line number Diff line change @@ -583,12 +583,12 @@ pub mod bytepipes {
583583
584584 impl BytePort for PipeBytePort {
585585 fn try_recv ( & self , count : uint ) -> Option < ~[ u8 ] > {
586- if vec :: uniq_len ( & const * self . buf ) >= count {
586+ if self . buf . len ( ) >= count {
587587 let mut bytes = :: core:: util:: replace ( & mut * self . buf , ~[ ] ) ;
588588 * self . buf = bytes. slice ( count, bytes. len ( ) ) . to_owned ( ) ;
589589 bytes. truncate ( count) ;
590590 return Some ( bytes) ;
591- } else if vec :: uniq_len ( & const * self . buf ) > 0 {
591+ } else if ! self . buf . is_empty ( ) {
592592 let mut bytes = :: core:: util:: replace ( & mut * self . buf , ~[ ] ) ;
593593 assert ! ( count > bytes. len( ) ) ;
594594 match self . try_recv ( count - bytes. len ( ) ) {
@@ -598,7 +598,7 @@ pub mod bytepipes {
598598 }
599599 None => return None
600600 }
601- } else if vec :: uniq_len ( & const * self . buf ) == 0 {
601+ } else /* empty */ {
602602 match self . port . try_recv ( ) {
603603 Some ( buf) => {
604604 assert ! ( !buf. is_empty( ) ) ;
@@ -607,8 +607,6 @@ pub mod bytepipes {
607607 }
608608 None => return None
609609 }
610- } else {
611- :: core:: util:: unreachable ( )
612610 }
613611 }
614612 }
Original file line number Diff line number Diff line change @@ -879,8 +879,7 @@ impl io::Reader for TcpSocketBuf {
879879
880880 // If possible, copy up to `len` bytes from the internal
881881 // `data.buf` into `buf`
882- let nbuffered = vec:: uniq_len ( & const self . data . buf ) -
883- self . data . buf_off ;
882+ let nbuffered = self . data . buf . len ( ) - self . data . buf_off ;
884883 let needed = len - count;
885884 if nbuffered > 0 {
886885 unsafe {
@@ -934,7 +933,7 @@ impl io::Reader for TcpSocketBuf {
934933 }
935934 fn read_byte ( & self ) -> int {
936935 loop {
937- if vec :: uniq_len ( & const self . data . buf ) > self . data . buf_off {
936+ if self . data . buf . len ( ) > self . data . buf_off {
938937 let c = self . data . buf [ self . data . buf_off ] ;
939938 self . data . buf_off += 1 ;
940939 return c as int
Original file line number Diff line number Diff line change @@ -35,10 +35,10 @@ impl<T:Ord> BaseIter<T> for PriorityQueue<T> {
3535
3636impl < T : Ord > Container for PriorityQueue < T > {
3737 /// Returns the length of the queue
38- fn len ( & const self ) -> uint { vec :: uniq_len ( & const self . data ) }
38+ fn len ( & self ) -> uint { self . data . len ( ) }
3939
4040 /// Returns true if a queue contains no elements
41- fn is_empty ( & const self ) -> bool { self . len ( ) == 0 }
41+ fn is_empty ( & self ) -> bool { self . len ( ) == 0 }
4242}
4343
4444impl < T : Ord > Mutable for PriorityQueue < T > {
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ pub fn sha1() -> @Sha1 {
9393 }
9494 fn process_msg_block ( st : & mut Sha1State ) {
9595 assert_eq ! ( st. h. len( ) , digest_buf_len) ;
96- assert_eq ! ( vec :: uniq_len ( st. work_buf) , work_buf_len) ;
96+ assert_eq ! ( st. work_buf. len ( ) , work_buf_len) ;
9797 let mut t: int ; // Loop counter
9898 let w = st. work_buf ;
9999
Original file line number Diff line number Diff line change @@ -32,9 +32,9 @@ pub struct SmallIntMap<T> {
3232
3333impl < V > Container for SmallIntMap < V > {
3434 /// Return the number of elements in the map
35- fn len ( & const self ) -> uint {
35+ fn len ( & self ) -> uint {
3636 let mut sz = 0 ;
37- for uint:: range( 0 , vec :: uniq_len ( & const self. v) ) |i| {
37+ for uint:: range( 0 , self . v. len ( ) ) |i| {
3838 match self . v [ i] {
3939 Some ( _) => sz += 1 ,
4040 None => { }
@@ -44,7 +44,7 @@ impl<V> Container for SmallIntMap<V> {
4444 }
4545
4646 /// Return true if the map contains no elements
47- fn is_empty ( & const self ) -> bool { self . len ( ) == 0 }
47+ fn is_empty ( & self ) -> bool { self . len ( ) == 0 }
4848}
4949
5050impl < V > Mutable for SmallIntMap < V > {
@@ -199,12 +199,12 @@ pub struct SmallIntSet {
199199
200200impl Container for SmallIntSet {
201201 /// Return the number of elements in the map
202- fn len ( & const self ) -> uint {
202+ fn len ( & self ) -> uint {
203203 self . map . len ( )
204204 }
205205
206206 /// Return true if the map contains no elements
207- fn is_empty ( & const self ) -> bool { self . len ( ) == 0 }
207+ fn is_empty ( & self ) -> bool { self . len ( ) == 0 }
208208}
209209
210210impl Mutable for SmallIntSet {
Original file line number Diff line number Diff line change @@ -365,7 +365,7 @@ pub fn run_tests_console(opts: &TestOpts,
365365fn print_failures(st: &ConsoleTestState) {
366366 st.out.write_line(" \n failures: ");
367367 let mut failures = ~[];
368- for uint::range(0, vec::uniq_len(&const st.failures)) |i| {
368+ for uint::range(0, st.failures.len( )) |i| {
369369 let name = copy st.failures[i].name;
370370 failures.push(name.to_str());
371371 }
Original file line number Diff line number Diff line change @@ -209,7 +209,7 @@ impl<T: Owned> Peekable<T> for PortSet<T> {
209209 fn peek ( & self ) -> bool {
210210 // It'd be nice to use self.port.each, but that version isn't
211211 // pure.
212- for uint:: range( 0 , vec :: uniq_len ( & const self. ports) ) |i| {
212+ for uint:: range( 0 , self . ports. len ( ) ) |i| {
213213 let port: & pipesy:: Port < T > = & self . ports [ i] ;
214214 if port. peek ( ) {
215215 return true ;
Original file line number Diff line number Diff line change @@ -16,10 +16,10 @@ use option::Option;
1616/// knowledge known is the number of elements contained within.
1717pub trait Container {
1818 /// Return the number of elements in the container
19- fn len ( & const self ) -> uint ;
19+ fn len ( & self ) -> uint ;
2020
2121 /// Return true if the container contains no elements
22- fn is_empty ( & const self ) -> bool ;
22+ fn is_empty ( & self ) -> bool ;
2323}
2424
2525/// A trait to represent mutable containers
Original file line number Diff line number Diff line change @@ -1667,7 +1667,7 @@ impl Writer for BytesWriter {
16671667
16681668 fn seek ( & self , offset : int , whence : SeekStyle ) {
16691669 let pos = * self . pos ;
1670- let len = vec :: uniq_len ( & const * self . bytes ) ;
1670+ let len = self . bytes . len ( ) ;
16711671 * self . pos = seek_in_buf ( offset, pos, len, whence) ;
16721672 }
16731673
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ More runtime type reflection
1818
1919use cast:: transmute;
2020use char;
21+ use container:: Container ;
2122use intrinsic;
2223use intrinsic:: { TyDesc , TyVisitor , visit_tydesc} ;
2324use intrinsic:: Opaque ;
@@ -502,7 +503,7 @@ impl TyVisitor for ReprVisitor {
502503 _offset : uint ,
503504 inner : * TyDesc )
504505 -> bool {
505- match self . var_stk [ vec :: uniq_len ( & const * self . var_stk ) - 1 ] {
506+ match self . var_stk [ self . var_stk . len ( ) - 1 ] {
506507 Matched => {
507508 if i != 0 {
508509 self . writer . write_str ( ", " ) ;
@@ -520,7 +521,7 @@ impl TyVisitor for ReprVisitor {
520521 _disr_val : int ,
521522 n_fields : uint ,
522523 _name : & str ) -> bool {
523- match self . var_stk [ vec :: uniq_len ( & const * self . var_stk ) - 1 ] {
524+ match self . var_stk [ self . var_stk . len ( ) - 1 ] {
524525 Matched => {
525526 if n_fields > 0 {
526527 self . writer . write_char ( ')' ) ;
You can’t perform that action at this time.
0 commit comments