2022-06-04 11:34:07 +00:00
|
|
|
error: initializing a reference-counted pointer in `vec![elem; len]`
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/rc_clone_in_vec_init/arc.rs:9:13
|
2022-05-21 11:24:00 +00:00
|
|
|
|
|
|
|
|
LL | let v = vec![Arc::new("x".to_string()); 2];
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: each element will point to the same `Arc` instance
|
2022-09-22 16:04:22 +00:00
|
|
|
= note: `-D clippy::rc-clone-in-vec-init` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::rc_clone_in_vec_init)]`
|
2022-05-21 11:24:00 +00:00
|
|
|
help: consider initializing each `Arc` element individually
|
|
|
|
|
|
|
|
|
LL ~ let v = {
|
|
|
|
LL + let mut v = Vec::with_capacity(2);
|
2022-06-04 11:34:07 +00:00
|
|
|
LL + (0..2).for_each(|_| v.push(Arc::new(..)));
|
2022-05-21 11:24:00 +00:00
|
|
|
LL + v
|
|
|
|
LL ~ };
|
|
|
|
|
|
|
|
|
help: or if this is intentional, consider extracting the `Arc` initialization to a variable
|
|
|
|
|
|
|
|
|
LL ~ let v = {
|
2022-06-04 11:34:07 +00:00
|
|
|
LL + let data = Arc::new(..);
|
2022-05-21 11:24:00 +00:00
|
|
|
LL + vec![data; 2]
|
|
|
|
LL ~ };
|
|
|
|
|
|
|
|
|
|
2022-06-04 11:34:07 +00:00
|
|
|
error: initializing a reference-counted pointer in `vec![elem; len]`
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/rc_clone_in_vec_init/arc.rs:19:21
|
2022-05-21 11:24:00 +00:00
|
|
|
|
|
|
|
|
LL | let v = vec![Arc::new("x".to_string()); 2];
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: each element will point to the same `Arc` instance
|
|
|
|
help: consider initializing each `Arc` element individually
|
|
|
|
|
|
|
|
|
LL ~ let v = {
|
|
|
|
LL + let mut v = Vec::with_capacity(2);
|
2022-06-04 11:34:07 +00:00
|
|
|
LL + (0..2).for_each(|_| v.push(Arc::new(..)));
|
2022-05-21 11:24:00 +00:00
|
|
|
LL + v
|
|
|
|
LL ~ };
|
|
|
|
|
|
|
|
|
help: or if this is intentional, consider extracting the `Arc` initialization to a variable
|
|
|
|
|
|
|
|
|
LL ~ let v = {
|
2022-06-04 11:34:07 +00:00
|
|
|
LL + let data = Arc::new(..);
|
2022-05-21 11:24:00 +00:00
|
|
|
LL + vec![data; 2]
|
|
|
|
LL ~ };
|
|
|
|
|
|
|
|
|
|
2022-06-04 11:34:07 +00:00
|
|
|
error: initializing a reference-counted pointer in `vec![elem; len]`
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/rc_clone_in_vec_init/arc.rs:27:13
|
2022-05-21 11:24:00 +00:00
|
|
|
|
|
|
|
|
LL | let v = vec![
|
|
|
|
| _____________^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
|
|
|
LL | |
|
2022-05-21 11:24:00 +00:00
|
|
|
LL | | std::sync::Arc::new(Mutex::new({
|
|
|
|
... |
|
|
|
|
LL | | 2
|
|
|
|
LL | | ];
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
= note: each element will point to the same `Arc` instance
|
|
|
|
help: consider initializing each `Arc` element individually
|
|
|
|
|
|
|
|
|
LL ~ let v = {
|
|
|
|
LL + let mut v = Vec::with_capacity(2);
|
|
|
|
LL + (0..2).for_each(|_| v.push(std::sync::Arc::new(..)));
|
|
|
|
LL + v
|
|
|
|
LL ~ };
|
|
|
|
|
|
|
|
|
help: or if this is intentional, consider extracting the `Arc` initialization to a variable
|
|
|
|
|
|
|
|
|
LL ~ let v = {
|
|
|
|
LL + let data = std::sync::Arc::new(..);
|
|
|
|
LL + vec![data; 2]
|
|
|
|
LL ~ };
|
|
|
|
|
|
|
|
|
|
2022-06-04 11:34:07 +00:00
|
|
|
error: initializing a reference-counted pointer in `vec![elem; len]`
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/rc_clone_in_vec_init/arc.rs:38:14
|
2022-05-21 11:24:00 +00:00
|
|
|
|
|
|
|
|
LL | let v1 = vec![
|
|
|
|
| ______________^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
|
|
|
LL | |
|
2022-05-21 11:24:00 +00:00
|
|
|
LL | | Arc::new(Mutex::new({
|
|
|
|
... |
|
|
|
|
LL | | 2
|
|
|
|
LL | | ];
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
= note: each element will point to the same `Arc` instance
|
|
|
|
help: consider initializing each `Arc` element individually
|
|
|
|
|
|
|
|
|
LL ~ let v1 = {
|
|
|
|
LL + let mut v = Vec::with_capacity(2);
|
|
|
|
LL + (0..2).for_each(|_| v.push(Arc::new(..)));
|
|
|
|
LL + v
|
|
|
|
LL ~ };
|
|
|
|
|
|
|
|
|
help: or if this is intentional, consider extracting the `Arc` initialization to a variable
|
|
|
|
|
|
|
|
|
LL ~ let v1 = {
|
|
|
|
LL + let data = Arc::new(..);
|
|
|
|
LL + vec![data; 2]
|
|
|
|
LL ~ };
|
|
|
|
|
|
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
|