about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-02-17 15:41:34 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-02-17 17:33:18 +0530
commit2833976cccf6ce8e9740ac5f055435ba17a28b9e (patch)
tree0eb68b5241edf8263063ce1534c22d722a28075b /src/libstd
parentc0865dfe1c74a0720a2d53d3e2f5aa6fdfde852a (diff)
parent7d941fa61fa38f13347de8e0522e9084683795e3 (diff)
downloadrust-2833976cccf6ce8e9740ac5f055435ba17a28b9e.tar.gz
rust-2833976cccf6ce8e9740ac5f055435ba17a28b9e.zip
Rollup merge of #22402 - nagisa:spring-cleanup-2, r=nikomatsakis
This commit mostly replaces some of the uses of os::args with env::args.

This, for obvious reasons is based on top of #22400. Do not r+ before that lands.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/env.rs8
-rw-r--r--src/libstd/sys/unix/os.rs4
-rw-r--r--src/libstd/sys/windows/os.rs4
3 files changed, 16 insertions, 0 deletions
diff --git a/src/libstd/env.rs b/src/libstd/env.rs
index ea18838211f..93dc3efe2c4 100644
--- a/src/libstd/env.rs
+++ b/src/libstd/env.rs
@@ -488,12 +488,20 @@ impl Iterator for Args {
     fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
 }
 
+impl ExactSizeIterator for Args {
+    fn len(&self) -> usize { self.inner.len() }
+}
+
 impl Iterator for ArgsOs {
     type Item = OsString;
     fn next(&mut self) -> Option<OsString> { self.inner.next() }
     fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
 }
 
+impl ExactSizeIterator for ArgsOs {
+    fn len(&self) -> usize { self.inner.len() }
+}
+
 /// Returns the page size of the current architecture in bytes.
 pub fn page_size() -> usize {
     os_imp::page_size()
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs
index 8a6ef17818a..df03841276e 100644
--- a/src/libstd/sys/unix/os.rs
+++ b/src/libstd/sys/unix/os.rs
@@ -247,6 +247,10 @@ impl Iterator for Args {
     fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
 }
 
+impl ExactSizeIterator for Args {
+    fn len(&self) -> usize { self.iter.len() }
+}
+
 /// Returns the command line arguments
 ///
 /// Returns a list of the command line arguments.
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs
index 7e684c52341..6aa1ac04ca9 100644
--- a/src/libstd/sys/windows/os.rs
+++ b/src/libstd/sys/windows/os.rs
@@ -303,6 +303,10 @@ impl Iterator for Args {
     fn size_hint(&self) -> (usize, Option<usize>) { self.range.size_hint() }
 }
 
+impl ExactSizeIterator for Args {
+    fn len(&self) -> usize { self.range.len() }
+}
+
 impl Drop for Args {
     fn drop(&mut self) {
         unsafe { c::LocalFree(self.cur as *mut c_void); }