Skip to content

RangeFrom::max should return None #47169

Closed
@varkor

Description

@varkor

Iterator::max states "If the iterator is empty, None is returned.". In the case of an unbounded range, we know that this maximum does not exist. This means RangeFrom::max is consigned to looping forever.

If the documentation for Iterator::max were rewritten: "If the iterator is empty, or if the maximum element is unbounded, None is returned.", this could then be implemented as special cases for unbounded iterators (e.g. RangeFrom), which is far more useful and intuitive.

The same complaint goes for Iterator::last.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions