3 #![deny(clippy::identity_conversion)]
5 fn test_generic<T: Copy>(val: T) -> T {
10 fn test_generic2<T: Copy + Into<i32> + Into<U>, U: From<T>>(val: T) {
12 let _: i32 = val.into();
13 let _: U = val.into();
17 fn test_questionmark() -> Result<(), ()> {
19 let _: i32 = 0i32.into();
25 fn test_issue_3913() -> Result<(), std::io::Error> {
29 let path = Path::new(".");
30 for _ in fs::read_dir(path)? {}
37 test_generic2::<i32, i32>(10i32);
38 test_questionmark().unwrap();
39 test_issue_3913().unwrap();
41 let _: String = "foo".into();
42 let _: String = From::from("foo");
43 let _ = String::from("foo");
44 #[allow(clippy::identity_conversion)]
46 let _: String = "foo".into();
47 let _ = String::from("foo");
48 let _ = "".lines().into_iter();
51 let _: String = "foo".to_string().into();
52 let _: String = From::from("foo".to_string());
53 let _ = String::from("foo".to_string());
54 let _ = String::from(format!("A: {:04}", 123));
55 let _ = "".lines().into_iter();
56 let _ = vec![1, 2, 3].into_iter().into_iter();
57 let _: String = format!("Hello {}", "world").into();