diff options
| author | bors <bors@rust-lang.org> | 2016-12-07 07:15:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-12-07 07:15:31 +0000 |
| commit | 5938eba4e30b766751483e93776a87a4db1681f4 (patch) | |
| tree | 1e497c14aaafb3a0471925118e5efb62963eb66b /src/libstd | |
| parent | 02ea82ddb8315249067afb2f800d62b4ca1f7678 (diff) | |
| parent | d53f82c1d037bf224a72a11747e7788f14b52db5 (diff) | |
| download | rust-5938eba4e30b766751483e93776a87a4db1681f4.tar.gz rust-5938eba4e30b766751483e93776a87a4db1681f4.zip | |
Auto merge of #38149 - bluss:is-empty, r=alexcrichton
Forward more ExactSizeIterator methods and `is_empty` edits - Forward ExactSizeIterator methods in more places, like `&mut I` and `Box<I>` iterator impls. - Improve `VecDeque::is_empty` itself (see commit 4) - All the collections iterators now have `len` or `is_empty` forwarded if doing so is a benefit. In the remaining cases, they already use a simple size hint (using something like a stored `usize` value), which is sufficient for the default implementation of len and is_empty.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/env.rs | 2 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/libstd/env.rs b/src/libstd/env.rs index baa2b5d2846..ee6a907f616 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -630,6 +630,7 @@ impl Iterator for Args { #[stable(feature = "env", since = "1.0.0")] impl ExactSizeIterator for Args { fn len(&self) -> usize { self.inner.len() } + fn is_empty(&self) -> bool { self.inner.is_empty() } } #[stable(feature = "env_iterators", since = "1.11.0")] @@ -649,6 +650,7 @@ impl Iterator for ArgsOs { #[stable(feature = "env", since = "1.0.0")] impl ExactSizeIterator for ArgsOs { fn len(&self) -> usize { self.inner.len() } + fn is_empty(&self) -> bool { self.inner.is_empty() } } #[stable(feature = "env_iterators", since = "1.11.0")] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 8132b139260..1f40d3fd1d3 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -250,6 +250,7 @@ #![feature(core_float)] #![feature(core_intrinsics)] #![feature(dropck_parametricity)] +#![feature(exact_size_is_empty)] #![feature(float_extras)] #![feature(float_from_str_radix)] #![feature(fn_traits)] |
