diff options
| author | bors <bors@rust-lang.org> | 2013-06-15 23:10:12 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-06-15 23:10:12 -0700 |
| commit | 8482d29d9b27a00e2d84bbf3bc0a3d14c61e34ba (patch) | |
| tree | 2f9642874bcf470b735cb179be96ecbd77db56e3 /src/libextra | |
| parent | 5572023cd868c5b6045bc91355cd21465c59ff6d (diff) | |
| parent | 7f00ab3df10b8b648872edf25fb1700168b306de (diff) | |
auto merge of #7149 : thestinger/rust/vec, r=graydon
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/flatpipes.rs | 8 | ||||
| -rw-r--r-- | src/libextra/net_tcp.rs | 5 | ||||
| -rw-r--r-- | src/libextra/priority_queue.rs | 4 | ||||
| -rw-r--r-- | src/libextra/sha1.rs | 2 | ||||
| -rw-r--r-- | src/libextra/smallintmap.rs | 10 | ||||
| -rw-r--r-- | src/libextra/test.rs | 2 |
6 files changed, 14 insertions, 17 deletions
diff --git a/src/libextra/flatpipes.rs b/src/libextra/flatpipes.rs index c0f619c1b85..4ff67fc3f42 100644 --- a/src/libextra/flatpipes.rs +++ b/src/libextra/flatpipes.rs @@ -583,12 +583,12 @@ pub mod bytepipes { impl BytePort for PipeBytePort { fn try_recv(&self, count: uint) -> Option<~[u8]> { - if vec::uniq_len(&const *self.buf) >= count { + if self.buf.len() >= count { let mut bytes = ::core::util::replace(&mut *self.buf, ~[]); *self.buf = bytes.slice(count, bytes.len()).to_owned(); bytes.truncate(count); return Some(bytes); - } else if vec::uniq_len(&const *self.buf) > 0 { + } else if !self.buf.is_empty() { let mut bytes = ::core::util::replace(&mut *self.buf, ~[]); assert!(count > bytes.len()); match self.try_recv(count - bytes.len()) { @@ -598,7 +598,7 @@ pub mod bytepipes { } None => return None } - } else if vec::uniq_len(&const *self.buf) == 0 { + } else /* empty */ { match self.port.try_recv() { Some(buf) => { assert!(!buf.is_empty()); @@ -607,8 +607,6 @@ pub mod bytepipes { } None => return None } - } else { - ::core::util::unreachable() } } } diff --git a/src/libextra/net_tcp.rs b/src/libextra/net_tcp.rs index d95807f2b91..28b3700399a 100644 --- a/src/libextra/net_tcp.rs +++ b/src/libextra/net_tcp.rs @@ -879,8 +879,7 @@ impl io::Reader for TcpSocketBuf { // If possible, copy up to `len` bytes from the internal // `data.buf` into `buf` - let nbuffered = vec::uniq_len(&const self.data.buf) - - self.data.buf_off; + let nbuffered = self.data.buf.len() - self.data.buf_off; let needed = len - count; if nbuffered > 0 { unsafe { @@ -934,7 +933,7 @@ impl io::Reader for TcpSocketBuf { } fn read_byte(&self) -> int { loop { - if vec::uniq_len(&const self.data.buf) > self.data.buf_off { + if self.data.buf.len() > self.data.buf_off { let c = self.data.buf[self.data.buf_off]; self.data.buf_off += 1; return c as int diff --git a/src/libextra/priority_queue.rs b/src/libextra/priority_queue.rs index 601b7685f3c..efbf23f11b1 100644 --- a/src/libextra/priority_queue.rs +++ b/src/libextra/priority_queue.rs @@ -35,10 +35,10 @@ impl<T:Ord> BaseIter<T> for PriorityQueue<T> { impl<T:Ord> Container for PriorityQueue<T> { /// Returns the length of the queue - fn len(&const self) -> uint { vec::uniq_len(&const self.data) } + fn len(&self) -> uint { self.data.len() } /// Returns true if a queue contains no elements - fn is_empty(&const self) -> bool { self.len() == 0 } + fn is_empty(&self) -> bool { self.len() == 0 } } impl<T:Ord> Mutable for PriorityQueue<T> { diff --git a/src/libextra/sha1.rs b/src/libextra/sha1.rs index 908e497b959..0c35630345b 100644 --- a/src/libextra/sha1.rs +++ b/src/libextra/sha1.rs @@ -93,7 +93,7 @@ pub fn sha1() -> @Sha1 { } fn process_msg_block(st: &mut Sha1State) { assert_eq!(st.h.len(), digest_buf_len); - assert_eq!(vec::uniq_len(st.work_buf), work_buf_len); + assert_eq!(st.work_buf.len(), work_buf_len); let mut t: int; // Loop counter let w = st.work_buf; diff --git a/src/libextra/smallintmap.rs b/src/libextra/smallintmap.rs index 7f566bc16e7..dae9113b3a9 100644 --- a/src/libextra/smallintmap.rs +++ b/src/libextra/smallintmap.rs @@ -32,9 +32,9 @@ pub struct SmallIntMap<T> { impl<V> Container for SmallIntMap<V> { /// Return the number of elements in the map - fn len(&const self) -> uint { + fn len(&self) -> uint { let mut sz = 0; - for uint::range(0, vec::uniq_len(&const self.v)) |i| { + for uint::range(0, self.v.len()) |i| { match self.v[i] { Some(_) => sz += 1, None => {} @@ -44,7 +44,7 @@ impl<V> Container for SmallIntMap<V> { } /// Return true if the map contains no elements - fn is_empty(&const self) -> bool { self.len() == 0 } + fn is_empty(&self) -> bool { self.len() == 0 } } impl<V> Mutable for SmallIntMap<V> { @@ -199,12 +199,12 @@ pub struct SmallIntSet { impl Container for SmallIntSet { /// Return the number of elements in the map - fn len(&const self) -> uint { + fn len(&self) -> uint { self.map.len() } /// Return true if the map contains no elements - fn is_empty(&const self) -> bool { self.len() == 0 } + fn is_empty(&self) -> bool { self.len() == 0 } } impl Mutable for SmallIntSet { diff --git a/src/libextra/test.rs b/src/libextra/test.rs index 406dfb086ea..a465cef09e6 100644 --- a/src/libextra/test.rs +++ b/src/libextra/test.rs @@ -365,7 +365,7 @@ pub fn run_tests_console(opts: &TestOpts, fn print_failures(st: &ConsoleTestState) { st.out.write_line("\nfailures:"); let mut failures = ~[]; - for uint::range(0, vec::uniq_len(&const st.failures)) |i| { + for uint::range(0, st.failures.len()) |i| { let name = copy st.failures[i].name; failures.push(name.to_str()); } |
