error: initializing a reference-counted pointer in `vec![elem; len]` --> $DIR/weak.rs:9:13 | LL | let v = vec![SyncWeak::::new(); 2]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: each element will point to the same `Weak` instance = note: `-D clippy::rc-clone-in-vec-init` implied by `-D warnings` help: consider initializing each `Weak` element individually | LL ~ let v = { LL + let mut v = Vec::with_capacity(2); LL + (0..2).for_each(|_| v.push(SyncWeak::::new(..))); LL + v LL ~ }; | help: or if this is intentional, consider extracting the `Weak` initialization to a variable | LL ~ let v = { LL + let data = SyncWeak::::new(..); LL + vec![data; 2] LL ~ }; | error: initializing a reference-counted pointer in `vec![elem; len]` --> $DIR/weak.rs:10:14 | LL | let v2 = vec![UnSyncWeak::::new(); 2]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: each element will point to the same `Weak` instance help: consider initializing each `Weak` element individually | LL ~ let v2 = { LL + let mut v = Vec::with_capacity(2); LL + (0..2).for_each(|_| v.push(UnSyncWeak::::new(..))); LL + v LL ~ }; | help: or if this is intentional, consider extracting the `Weak` initialization to a variable | LL ~ let v2 = { LL + let data = UnSyncWeak::::new(..); LL + vec![data; 2] LL ~ }; | error: initializing a reference-counted pointer in `vec![elem; len]` --> $DIR/weak.rs:12:13 | LL | let v = vec![Rc::downgrade(&Rc::new("x".to_string())); 2]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: each element will point to the same `Weak` instance help: consider initializing each `Weak` element individually | LL ~ let v = { LL + let mut v = Vec::with_capacity(2); LL + (0..2).for_each(|_| v.push(Rc::downgrade(..))); LL + v LL ~ }; | help: or if this is intentional, consider extracting the `Weak` initialization to a variable | LL ~ let v = { LL + let data = Rc::downgrade(..); LL + vec![data; 2] LL ~ }; | error: initializing a reference-counted pointer in `vec![elem; len]` --> $DIR/weak.rs:13:13 | LL | let v = vec![Arc::downgrade(&Arc::new("x".to_string())); 2]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: each element will point to the same `Weak` instance help: consider initializing each `Weak` element individually | LL ~ let v = { LL + let mut v = Vec::with_capacity(2); LL + (0..2).for_each(|_| v.push(Arc::downgrade(..))); LL + v LL ~ }; | help: or if this is intentional, consider extracting the `Weak` initialization to a variable | LL ~ let v = { LL + let data = Arc::downgrade(..); LL + vec![data; 2] LL ~ }; | error: initializing a reference-counted pointer in `vec![elem; len]` --> $DIR/weak.rs:21:21 | LL | let v = vec![Arc::downgrade(&Arc::new("x".to_string())); 2]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: each element will point to the same `Weak` instance help: consider initializing each `Weak` element individually | LL ~ let v = { LL + let mut v = Vec::with_capacity(2); LL + (0..2).for_each(|_| v.push(Arc::downgrade(..))); LL + v LL ~ }; | help: or if this is intentional, consider extracting the `Weak` initialization to a variable | LL ~ let v = { LL + let data = Arc::downgrade(..); LL + vec![data; 2] LL ~ }; | error: initializing a reference-counted pointer in `vec![elem; len]` --> $DIR/weak.rs:22:22 | LL | let v2 = vec![Rc::downgrade(&Rc::new("x".to_string())); 2]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: each element will point to the same `Weak` instance help: consider initializing each `Weak` element individually | LL ~ let v2 = { LL + let mut v = Vec::with_capacity(2); LL + (0..2).for_each(|_| v.push(Rc::downgrade(..))); LL + v LL ~ }; | help: or if this is intentional, consider extracting the `Weak` initialization to a variable | LL ~ let v2 = { LL + let data = Rc::downgrade(..); LL + vec![data; 2] LL ~ }; | error: initializing a reference-counted pointer in `vec![elem; len]` --> $DIR/weak.rs:28:13 | LL | let v = vec![ | _____________^ LL | | Arc::downgrade(&Arc::new(Mutex::new({ LL | | let x = 1; LL | | dbg!(x); ... | LL | | 2 LL | | ]; | |_____^ | = note: each element will point to the same `Weak` instance help: consider initializing each `Weak` element individually | LL ~ let v = { LL + let mut v = Vec::with_capacity(2); LL + (0..2).for_each(|_| v.push(Arc::downgrade(..))); LL + v LL ~ }; | help: or if this is intentional, consider extracting the `Weak` initialization to a variable | LL ~ let v = { LL + let data = Arc::downgrade(..); LL + vec![data; 2] LL ~ }; | error: initializing a reference-counted pointer in `vec![elem; len]` --> $DIR/weak.rs:37:14 | LL | let v1 = vec![ | ______________^ LL | | Rc::downgrade(&Rc::new(Mutex::new({ LL | | let x = 1; LL | | dbg!(x); ... | LL | | 2 LL | | ]; | |_____^ | = note: each element will point to the same `Weak` instance help: consider initializing each `Weak` element individually | LL ~ let v1 = { LL + let mut v = Vec::with_capacity(2); LL + (0..2).for_each(|_| v.push(Rc::downgrade(..))); LL + v LL ~ }; | help: or if this is intentional, consider extracting the `Weak` initialization to a variable | LL ~ let v1 = { LL + let data = Rc::downgrade(..); LL + vec![data; 2] LL ~ }; | error: aborting due to 8 previous errors