Skip to content

Commit 666646a

Browse files
committed
update documentation
1 parent 6a65476 commit 666646a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clippy_lints/src/ref_clone_in_vec_init.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_span::{sym, Symbol};
99

1010
declare_clippy_lint! {
1111
/// ### What it does
12-
/// Checks for `Arc::new` in `vec![elem; len]`
12+
/// Checks for `Arc::new` or `Rc::new` in `vec![elem; len]`
1313
///
1414
/// ### Why is this bad?
1515
/// This will create `elem` once and clone it `len` times - doing so with `Arc`
@@ -19,10 +19,14 @@ declare_clippy_lint! {
1919
/// ### Example
2020
/// ```rust
2121
/// let v = vec![std::sync::Arc::new("some data".to_string()); 100];
22+
/// // or
23+
/// let v = vec![std::rc::Rc::new("some data".to_string())];
2224
/// ```
2325
/// Use instead:
2426
/// ```rust
2527
/// let data = std::sync::Arc::new("some data".to_string());
28+
/// // or
29+
/// let data = std::rc::Rc::new("some data".to_string());
2630
/// let v = vec![data; 100];
2731
/// ```
2832
#[clippy::version = "1.62.0"]

0 commit comments

Comments
 (0)