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

Mutable accessor for Copy single-element Cell-like container #44

Closed
dtolnay opened this Issue May 3, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@dtolnay
Copy link
Member

dtolnay commented May 3, 2017

The guideline says:

Single-element containers where the element is Copy (e.g. Cell-like containers) should instead return the value directly, and not implement a mutable accessor.

And yet: Cell::get_mut

@Rufflewind

This comment has been minimized.

Copy link

Rufflewind commented Jun 1, 2017

That guideline is quite confusing. Why does the presence of Copy make mutable accessors undesirable?

@jonas-schievink

This comment has been minimized.

Copy link

jonas-schievink commented Jul 22, 2017

@Rufflewind My guess is that set should be used to put a new value into the container.

Cell::get_mut is no longer limited to Copy types, by the way, so it now matches the guideline.

@dtolnay

This comment has been minimized.

Copy link
Member Author

dtolnay commented Oct 28, 2017

Cell now works for non-Copy types and exposes get_mut for them, so I removed this special case from the guidelines in ee56222.

@dtolnay dtolnay closed this Oct 28, 2017

@kbknapp kbknapp referenced this issue Dec 7, 2017

Open

1.0 Release #16

15 of 57 tasks complete

@kbknapp kbknapp referenced this issue May 9, 2017

Open

Lib Blitz Style Summary and Overhaul #950

15 of 62 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.