2019-09-25 17:46:14 +00:00
|
|
|
#![allow(unused)]
|
2023-06-12 14:04:34 +00:00
|
|
|
#![allow(clippy::useless_vec)]
|
2019-09-25 17:46:14 +00:00
|
|
|
|
2023-07-03 17:42:48 +00:00
|
|
|
use std::collections::{HashSet, VecDeque};
|
2019-09-25 17:46:14 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let v = [1, 2, 3, 4, 5];
|
|
|
|
let v2: Vec<isize> = v.iter().cloned().collect();
|
|
|
|
let v3: HashSet<isize> = v.iter().cloned().collect();
|
|
|
|
let v4: VecDeque<isize> = v.iter().cloned().collect();
|
|
|
|
|
|
|
|
// Handle macro expansion in suggestion
|
|
|
|
let _: Vec<isize> = vec![1, 2, 3].iter().cloned().collect();
|
|
|
|
|
|
|
|
// Issue #3704
|
|
|
|
unsafe {
|
|
|
|
let _: Vec<u8> = std::ffi::CStr::from_ptr(std::ptr::null())
|
|
|
|
.to_bytes()
|
|
|
|
.iter()
|
|
|
|
.cloned()
|
|
|
|
.collect();
|
|
|
|
}
|
2021-04-26 20:03:51 +00:00
|
|
|
|
|
|
|
// Issue #6808
|
|
|
|
let arr: [u8; 64] = [0; 64];
|
|
|
|
let _: Vec<_> = arr.iter().cloned().collect();
|
2021-11-20 09:49:30 +00:00
|
|
|
|
|
|
|
// Issue #6703
|
|
|
|
let _: Vec<isize> = v.iter().copied().collect();
|
2019-09-25 17:46:14 +00:00
|
|
|
}
|