Skip to content
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

Option map/map_consume vs chain_ref/chain naming inconsistency #7830

Closed
bblum opened this issue Jul 16, 2013 · 4 comments
Closed

Option map/map_consume vs chain_ref/chain naming inconsistency #7830

bblum opened this issue Jul 16, 2013 · 4 comments
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@bblum
Copy link
Contributor

bblum commented Jul 16, 2013

map and chain_ref take the option by reference, and map_consume and chain take the option by value and unwrap it inside. We should decide whether we prefer the -consume or the -ref suffix, and standardize the stdlib to it. (I bet Either has the same problems.)

My vote is for the shorter name being consuming, and having a -ref suffix.

Nominating backwards-compatibility milestone. While not about language syntax, these functions are pervasive enough that renaming them after 1.0 would be a big hassle.

@Kimundi
Copy link
Member

Kimundi commented Jul 18, 2013

A possible naming convention for one-element containers:

  • get - get a reference to the element
  • take - move the element out, keeping the container intact but empty
  • unwrap - move the element out, consuming the container

@catamorphism
Copy link
Contributor

Accepted for backwards-compatible

@Kimundi
Copy link
Member

Kimundi commented Sep 12, 2013

related: #7887

@catamorphism
Copy link
Contributor

Obsolete

flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 24, 2022
…steffen

new lint: `recursive_format_impl`

The to_string_in_display lint is renamed to recursive_format_impl
A check is added for the use of self formatted with Display or Debug inside any format string in the same impl
The to_string_in_display check is kept as is - like in the format_in_format_args lint

This is my first contribution so please check it for better / more idiomatic checks + error messages. Note the format macro paths are shared with the `format_in_format_args` lint - maybe those could be moved to clippy utils too.

This relates to issues rust-lang#2691 and rust-lang#7830

------

changelog: Renamed `to_string_in_display` lint to [`recursive_format_impl`] with new check for any use of self as Display or Debug inside the same format trait impl.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

3 participants