2023-04-23 06:03:09 -05:00
|
|
|
//@run-rustfix
|
2022-10-23 08:18:45 -05:00
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
#![warn(clippy::cloned_instead_of_copied)]
|
2022-10-23 08:18:45 -05:00
|
|
|
#![allow(unused)]
|
2023-07-02 07:35:19 -05:00
|
|
|
#![allow(clippy::useless_vec)]
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// yay
|
|
|
|
let _ = [1].iter().copied();
|
|
|
|
let _ = vec!["hi"].iter().copied();
|
|
|
|
let _ = Some(&1).copied();
|
|
|
|
let _ = Box::new([1].iter()).copied();
|
|
|
|
let _ = Box::new(Some(&1)).copied();
|
|
|
|
|
|
|
|
// nay
|
|
|
|
let _ = [String::new()].iter().cloned();
|
|
|
|
let _ = Some(&String::new()).cloned();
|
|
|
|
}
|
2022-10-23 08:18:45 -05:00
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
#[clippy::msrv = "1.34"]
|
2022-10-23 08:18:45 -05:00
|
|
|
fn msrv_1_34() {
|
|
|
|
let _ = [1].iter().cloned();
|
|
|
|
let _ = Some(&1).cloned();
|
|
|
|
}
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
#[clippy::msrv = "1.35"]
|
2022-10-23 08:18:45 -05:00
|
|
|
fn msrv_1_35() {
|
|
|
|
let _ = [1].iter().cloned();
|
|
|
|
let _ = Some(&1).copied(); // Option::copied needs 1.35
|
|
|
|
}
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
#[clippy::msrv = "1.36"]
|
2022-10-23 08:18:45 -05:00
|
|
|
fn msrv_1_36() {
|
|
|
|
let _ = [1].iter().copied(); // Iterator::copied needs 1.36
|
|
|
|
let _ = Some(&1).copied();
|
|
|
|
}
|