1 // aux-build: proc_macro_with_span.rs
2 #![warn(clippy::unit_arg)]
3 #![allow(unused_must_use, unused_variables)]
5 clippy::let_unit_value,
6 clippy::needless_question_mark,
10 clippy::self_named_constructors,
11 clippy::uninlined_format_args,
12 clippy::unnecessary_wraps,
16 extern crate proc_macro_with_span;
18 use proc_macro_with_span::with_span;
21 fn foo<T: Debug>(t: T) {
25 fn foo3<T1: Debug, T2: Debug, T3: Debug>(t1: T1, t2: T2, t3: T3) {
26 println!("{:?}, {:?}, {:?}", t1, t2, t3);
32 fn bar<T: Debug>(&self, t: T) {
37 fn baz<T: Debug>(t: T) {
43 fn do_it(args: Self::Args);
49 fn do_it(_: Self::Args) {}
54 type Args = <A as Tr>::Args;
56 fn do_it(args: Self::Args) {
74 taking_multiple_units(foo(0), foo(1));
75 taking_multiple_units(foo(0), {
79 taking_multiple_units(
89 // here Some(foo(2)) isn't the top level statement expression, wrap the suggestion in a block
90 None.or(Some(foo(2)));
91 // in this case, the suggestion can be inlined, no need for a surrounding block
92 // foo(()); foo(()) instead of { foo(()); foo(()) }
100 foo3("a", 3, vec![3]);
105 let named_unit_arg = ();
111 fn question_mark() -> Result<(), ()> {
119 fn unit_fn() -> Result<(), i32> {
123 fn fallible() -> Result<(), i32> {
129 fn returning_expr() -> Option<()> {
133 fn taking_multiple_units(a: (), b: ()) {}
136 with_span!(span taking_multiple_units(unsafe { (); }, 'x: loop { break 'x (); }));