3 #![deny(clippy::useless_conversion)]
4 #![allow(clippy::unnecessary_wraps)]
6 fn test_generic<T: Copy>(val: T) -> T {
11 fn test_generic2<T: Copy + Into<i32> + Into<U>, U: From<T>>(val: T) {
13 let _: i32 = val.into();
14 let _: U = val.into();
18 fn test_questionmark() -> Result<(), ()> {
26 fn test_issue_3913() -> Result<(), std::io::Error> {
30 let path = Path::new(".");
31 for _ in fs::read_dir(path)? {}
36 fn test_issue_5833() -> Result<(), ()> {
37 let text = "foo\r\nbar\n\nbaz\n";
38 let lines = text.lines();
39 if Some("ok") == lines.into_iter().next() {}
46 test_generic2::<i32, i32>(10i32);
47 test_questionmark().unwrap();
48 test_issue_3913().unwrap();
49 test_issue_5833().unwrap();
51 let _: String = "foo".into();
52 let _: String = From::from("foo");
53 let _ = String::from("foo");
54 #[allow(clippy::useless_conversion)]
56 let _: String = "foo".into();
57 let _ = String::from("foo");
58 let _ = "".lines().into_iter();
61 let _: String = "foo".to_string();
62 let _: String = "foo".to_string();
63 let _ = "foo".to_string();
64 let _ = format!("A: {:04}", 123);
66 let _ = vec![1, 2, 3].into_iter();
67 let _: String = format!("Hello {}", "world");
69 // keep parenthesis around `a + b` for suggestion (see #4750)