3 #![deny(clippy::useless_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<(), ()> {
25 fn test_issue_3913() -> Result<(), std::io::Error> {
29 let path = Path::new(".");
30 for _ in fs::read_dir(path)? {}
35 fn test_issue_5833() -> Result<(), ()> {
36 let text = "foo\r\nbar\n\nbaz\n";
37 let lines = text.lines();
38 if Some("ok") == lines.into_iter().next() {}
45 test_generic2::<i32, i32>(10i32);
46 test_questionmark().unwrap();
47 test_issue_3913().unwrap();
48 test_issue_5833().unwrap();
50 let _: String = "foo".into();
51 let _: String = From::from("foo");
52 let _ = String::from("foo");
53 #[allow(clippy::useless_conversion)]
55 let _: String = "foo".into();
56 let _ = String::from("foo");
57 let _ = "".lines().into_iter();
60 let _: String = "foo".to_string();
61 let _: String = "foo".to_string();
62 let _ = "foo".to_string();
63 let _ = format!("A: {:04}", 123);
65 let _ = vec![1, 2, 3].into_iter();
66 let _: String = format!("Hello {}", "world");