-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
unwrap/get/get_ref/take etc. conventions #13159
Comments
Off-line with @brson and @alexcrichton suggested that there is some sort of conventions, though they are not universally followed. These conventions can be roughly broken down based on what sort of
One name that I did not list is
In all cases, these operations can be fallible or infallible depending on the type, which is perhaps unfortunate. I'd like to remedy this if possible but I'm not sure if it is. |
how about .v() returns a (cloned) value, and .r() returns a ref? (If |
It'd be nice if we could separate the fallable and infallable methods naming-wise somehow. I always double-take a bit when seeing an |
I was hoping to incorporate the word Some ideas:
One a related note, I think we should at some point remove In general, the best state is one where the only fallible APIs are Option/Result's |
An infallible one should probably just be a |
I don't think |
On Sat, Mar 29, 2014 at 12:18:36AM -0700, Steven Fackler wrote:
I tend to agree. It's likely we can overcome the by-value restriction |
marking P-backcompat-libs, 1.0 |
The guidelines now have a convention for these names. I will be rolling them out in a patch soon. |
This change applies the conventions to unwrap listed in [RFC 430][rfc] to rename non-failing `unwrap` methods to `into_inner`. This is a breaking change, but all `unwrap` methods are retained as `#[deprecated]` for the near future. To update code rename `unwrap` method calls to `into_inner`. [rfc]: rust-lang/rfcs#430 [breaking-change] Closes rust-lang#13159 cc rust-lang#19091
…e-order, r=dswij `missing_trait_methods`: lint methods in definition order Lintcheck for rust-lang#13157 showed a bunch of changes for `missing_trait_methods` This is because `values_sorted` was sorting the entries by the key's [`DefPathHash`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/def_id/struct.DefPathHash.html), this is stable for a given compiler but can change across versions changelog: none
I'm sure there are other issues about this, which naturally I can't find. We need to make sure the conventions for these accessors are consistent for 1.0. Nominating.
The text was updated successfully, but these errors were encountered: