diff options
| author | Aaron Turon <aturon@mozilla.com> | 2014-06-05 23:18:51 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-06-06 19:51:31 -0700 |
| commit | 1bde6e3fcb32ca00cf8a8dfa0977e47f7f4a77bf (patch) | |
| tree | f5b2c5f46adc3cdc83e596445cc91e5112ea68b6 /src/librustdoc/html/toc.rs | |
| parent | 1bc29924dc8f88c2c118b688f25ffa7c6a212276 (diff) | |
| download | rust-1bde6e3fcb32ca00cf8a8dfa0977e47f7f4a77bf.tar.gz rust-1bde6e3fcb32ca00cf8a8dfa0977e47f7f4a77bf.zip | |
Rename Iterator::len to count
This commit carries out the request from issue #14678: > The method `Iterator::len()` is surprising, as all the other uses of > `len()` do not consume the value. `len()` would make more sense to be > called `count()`, but that would collide with the current > `Iterator::count(|T| -> bool) -> unit` method. That method, however, is > a bit redundant, and can be easily replaced with > `iter.filter(|x| x < 5).count()`. > After this change, we could then define the `len()` method > on `iter::ExactSize`. Closes #14678. [breaking-change]
Diffstat (limited to 'src/librustdoc/html/toc.rs')
| -rw-r--r-- | src/librustdoc/html/toc.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs index 2356d4c754f..5bc6d8031ac 100644 --- a/src/librustdoc/html/toc.rs +++ b/src/librustdoc/html/toc.rs @@ -32,7 +32,7 @@ pub struct Toc { impl Toc { fn count_entries_with_level(&self, level: u32) -> uint { - self.entries.iter().count(|e| e.level == level) + self.entries.iter().filter(|e| e.level == level).count() } } |
