rust/src/liballoc
Mazdak Farrokhzad 4486c02695
Rollup merge of #63252 - nrc:arc-doc, r=alexcrichton
Remove recommendation about idiomatic syntax for Arc::clone

I believe we should not make this recommendation. I don't want to argue that `Arc::clone` is less idiomatic than `arc.clone`, but that the choice is not clear cut and that we should not be making this kind of call in the docs.

The `.clone()` form has advantages too: it is more succinct, it is more likely to be understood by beginners, and it is more uniform with other `clone` calls, indeed with most other method calls.

Whichever approach is better, I think that this discussion belongs in a style guide or textbook, rather than the library docs. We don't talk much about idiomatic code in the docs, this place is pretty exceptional.

The recommendation is also not followed in this repo. It is hard to figure out how many calls there are of the `.clone()` form, but there are 1550 uses of `Arc` and only 65 uses of `Arc::clone`. The recommendation has existed for over two years.

The recommendation was added in https://github.com/rust-lang/rust/pull/42137, as a result of https://github.com/rust-lang/rfcs/pull/1954. However, note that that RFC was closed because it was not necessary to change the docs (the original RFC proposed a new function instead). So I don't think an RFC is necessary here (and I'm not trying to re-litigate the discussion on that RFC (which favoured `Arc::clone` as idiomatic) in any case).

cc @nical (who added the docs in the first place; sorry :-) )

r? @alexcrichton (or someone else on @rust-lang/libs )
2019-08-19 22:48:52 +02:00
..
alloc liballoc: Unconfigure tests during normal build 2019-08-02 01:59:01 +03:00
benches bump rand to fix Miri failures 2019-08-04 14:50:26 +02:00
collections Auto merge of #63045 - Rosto75:master, r=jonas-schievink 2019-08-18 22:01:21 +00:00
prelude Replace SliceConcatExt trait with inherent methods and SliceConcat helper trait 2019-07-05 11:49:30 +02:00
raw_vec liballoc: Unconfigure tests during normal build 2019-08-02 01:59:01 +03:00
rc Add implementations for converting boxed slices into boxed arrays 2019-08-05 10:26:53 -04:00
sync Add implementations for converting boxed slices into boxed arrays 2019-08-05 10:26:53 -04:00
tests Add the Layout of the failed allocation to TryReserveError::AllocError 2019-08-16 18:08:37 +02:00
alloc.rs liballoc: Unconfigure tests during normal build 2019-08-02 01:59:01 +03:00
borrow.rs Use associated_type_bounds where applicable - closes #61738 2019-08-08 22:39:15 +02:00
boxed.rs Doc nits 2019-08-17 15:42:05 +02:00
Cargo.toml bump rand to fix Miri failures 2019-08-04 14:50:26 +02:00
fmt.rs Make clear that format padding doesn't work for Debug 2019-04-13 15:39:49 +10:00
lib.rs Add the Layout of the failed allocation to TryReserveError::AllocError 2019-08-16 18:08:37 +02:00
macros.rs Hygienize use of built-in macros in the standard library 2019-08-15 22:58:50 +03:00
raw_vec.rs Add the Layout of the failed allocation to TryReserveError::AllocError 2019-08-16 18:08:37 +02:00
rc.rs Rename private helper method allocate_for_unsized to allocate_for_layout 2019-08-17 17:01:04 +02:00
slice.rs Update src/liballoc/slice.rs 2019-07-09 18:19:10 +02:00
str.rs Update src/liballoc/str.rs 2019-07-09 18:19:18 +02:00
string.rs Rename CollectionAllocError to TryReserveError 2019-08-16 18:08:06 +02:00
sync.rs Rollup merge of #63252 - nrc:arc-doc, r=alexcrichton 2019-08-19 22:48:52 +02:00
tests.rs Add implementations for converting boxed slices into boxed arrays 2019-08-05 10:26:53 -04:00
vec.rs Rename CollectionAllocError to TryReserveError 2019-08-16 18:08:06 +02:00