Skip to content

Rename core::vec::last_total to core::vec::last #1943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brson opened this issue Mar 8, 2012 · 2 comments
Closed

Rename core::vec::last_total to core::vec::last #1943

brson opened this issue Mar 8, 2012 · 2 comments

Comments

@brson
Copy link
Contributor

brson commented Mar 8, 2012

The current vec::last returns an option if there are no elements to return, while all the related functions fail. vec::last should just fail as well when the vec is empty

@catamorphism
Copy link
Contributor

Since the precondition has been removed from last_total, the name is wrong anyway, as is the associated comment.

@ghost ghost assigned catamorphism Mar 8, 2012
@catamorphism
Copy link
Contributor

I'm renaming last_total to last_unsafe. IMO the other functions should return an option too rather than failing, and variants that fail should have "unsafe" in the name. (Using a word other than "unsafe" would be ok with me, I just can't think of anything better.)

celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Kobzol pushed a commit to Kobzol/rust that referenced this issue Dec 30, 2024
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants