1 // aux-build: proc_macro_with_span.rs
3 #![warn(clippy::unit_arg)]
9 clippy::unnecessary_wraps,
11 clippy::needless_question_mark,
12 clippy::self_named_constructors,
13 clippy::let_unit_value,
17 extern crate proc_macro_with_span;
19 use proc_macro_with_span::with_span;
22 fn foo<T: Debug>(t: T) {
26 fn foo3<T1: Debug, T2: Debug, T3: Debug>(t1: T1, t2: T2, t3: T3) {
27 println!("{:?}, {:?}, {:?}", t1, t2, t3);
33 fn bar<T: Debug>(&self, t: T) {
38 fn baz<T: Debug>(t: T) {
44 fn do_it(args: Self::Args);
50 fn do_it(_: Self::Args) {}
55 type Args = <A as Tr>::Args;
57 fn do_it(args: Self::Args) {
75 taking_multiple_units(foo(0), foo(1));
76 taking_multiple_units(foo(0), {
80 taking_multiple_units(
90 // here Some(foo(2)) isn't the top level statement expression, wrap the suggestion in a block
91 None.or(Some(foo(2)));
92 // in this case, the suggestion can be inlined, no need for a surrounding block
93 // foo(()); foo(()) instead of { foo(()); foo(()) }
101 foo3("a", 3, vec![3]);
106 let named_unit_arg = ();
112 fn question_mark() -> Result<(), ()> {
120 fn unit_fn() -> Result<(), i32> {
124 fn fallible() -> Result<(), i32> {
130 fn returning_expr() -> Option<()> {
134 fn taking_multiple_units(a: (), b: ()) {}
137 with_span!(span taking_multiple_units(unsafe { (); }, 'x: loop { break 'x (); }));