blob: 7814f5b54036bf9d07646880408aa163c918736a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
error: initializing a reference-counted pointer in `vec![elem; len]`
--> $DIR/arc.rs:7:13
|
LL | let v = vec![Arc::new("x".to_string()); 2];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: each element will point to the same `Arc` instance
= note: `-D clippy::rc-clone-in-vec-init` implied by `-D warnings`
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(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 = Arc::new(..);
LL + vec![data; 2]
LL ~ };
|
error: initializing a reference-counted pointer in `vec![elem; len]`
--> $DIR/arc.rs:15:21
|
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);
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 v = {
LL + let data = Arc::new(..);
LL + vec![data; 2]
LL ~ };
|
error: initializing a reference-counted pointer in `vec![elem; len]`
--> $DIR/arc.rs:21:13
|
LL | let v = vec![
| _____________^
LL | | std::sync::Arc::new(Mutex::new({
LL | | let x = 1;
LL | | dbg!(x);
... |
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 ~ };
|
error: initializing a reference-counted pointer in `vec![elem; len]`
--> $DIR/arc.rs:30:14
|
LL | let v1 = vec![
| ______________^
LL | | Arc::new(Mutex::new({
LL | | let x = 1;
LL | | dbg!(x);
... |
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
|