Skip to content

Commit 949b834

Browse files
committed
Auto merge of #6090 - Fishrock123:rc_buffer-formatting-caveats, r=yaahc
lints: clarify rc_buffer and add caveats This didn't display some types properly in the docs due the lack of code formatting. Also, refs for the caveat: #6044 (comment) http-rs/surf#242 Fwiw I can't get `cargo test` to run, even on nightly. I get: ``` error[E0463]: can't find crate for `rustc_ast` ``` *Please keep the line below* changelog: none, nightly
2 parents ea079eb + 00e641b commit 949b834

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

clippy_lints/src/types.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,19 @@ declare_clippy_lint! {
216216
}
217217

218218
declare_clippy_lint! {
219-
/// **What it does:** Checks for Rc<T> and Arc<T> when T is a mutable buffer type such as String or Vec
219+
/// **What it does:** Checks for `Rc<T>` and `Arc<T>` when `T` is a mutable buffer type such as `String` or `Vec`.
220220
///
221-
/// **Why is this bad?** Expressions such as Rc<String> have no advantage over Rc<str>, since
222-
/// it is larger and involves an extra level of indirection, and doesn't implement Borrow<str>.
221+
/// **Why is this bad?** Expressions such as `Rc<String>` usually have no advantage over `Rc<str>`, since
222+
/// it is larger and involves an extra level of indirection, and doesn't implement `Borrow<str>`.
223223
///
224-
/// While mutating a buffer type would still be possible with Rc::get_mut(), it only
225-
/// works if there are no additional references yet, which defeats the purpose of
224+
/// While mutating a buffer type would still be possible with `Rc::get_mut()`, it only
225+
/// works if there are no additional references yet, which usually defeats the purpose of
226226
/// enclosing it in a shared ownership type. Instead, additionally wrapping the inner
227-
/// type with an interior mutable container (such as RefCell or Mutex) would normally
227+
/// type with an interior mutable container (such as `RefCell` or `Mutex`) would normally
228228
/// be used.
229229
///
230-
/// **Known problems:** None.
230+
/// **Known problems:** This pattern can be desirable to avoid the overhead of a `RefCell` or `Mutex` for
231+
/// cases where mutation only happens before there are any additional references.
231232
///
232233
/// **Example:**
233234
/// ```rust,ignore

0 commit comments

Comments
 (0)