Skip to content

Conversation

@aturon
Copy link
Contributor

@aturon aturon commented Jun 6, 2014

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]

This commit carries out the request from issue rust-lang#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 rust-lang#14678. [breaking-change]
@huonw
Copy link
Contributor

huonw commented Jun 8, 2014

FWIW, I think this should've just deprecated .len and not added len to ExactSize immediately, especially since it can silently change behaviour (unlike almost all other breaking changes).

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 7, 2023
Exclude non-identifier aliases from completion filtering text When building `CompletionItem`s, this excludes aliases that aren't valid identifiers from the "lookup" text used to filter completions in the LSP client. Including them results in weird completion filtering behavior e.g. `Partial>` matching a completion for the `PartialOrd` trait because it has a doc alias of ">". Closes rust-lang#14692
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants