2022-07-10 17:19:45 +00:00
|
|
|
//@ run-rustfix
|
|
|
|
#![allow(unused_variables)]
|
|
|
|
|
2018-09-09 12:05:46 +00:00
|
|
|
fn main() {
|
2022-07-10 17:19:45 +00:00
|
|
|
let items = vec![1, 2, 3];
|
|
|
|
let ref_items: &[i32] = &items;
|
|
|
|
let items_clone: Vec<i32> = ref_items.clone();
|
|
|
|
//~^ ERROR mismatched types
|
2018-09-09 12:05:46 +00:00
|
|
|
|
2022-07-10 17:19:45 +00:00
|
|
|
// in that case no suggestion will be triggered
|
|
|
|
let items_clone_2: Vec<i32> = items.clone();
|
2018-09-09 13:43:41 +00:00
|
|
|
|
2022-07-10 17:19:45 +00:00
|
|
|
let s = "hi";
|
|
|
|
let string: String = s.clone();
|
|
|
|
//~^ ERROR mismatched types
|
2018-09-09 13:43:41 +00:00
|
|
|
|
2022-07-10 17:19:45 +00:00
|
|
|
// in that case no suggestion will be triggered
|
|
|
|
let s2 = "hi";
|
|
|
|
let string_2: String = s2.to_string();
|
2018-09-09 12:05:46 +00:00
|
|
|
}
|