]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/unit_arg.rs
1 #![warn(clippy::unit_arg)]
7 clippy
::unnecessary_wraps
,
9 clippy
::needless_question_mark
,
10 clippy
::self_named_constructors
,
11 clippy
::let_unit_value
16 fn foo
<T
: Debug
>(t
: T
) {
20 fn foo3
<T1
: Debug
, T2
: Debug
, T3
: Debug
>(t1
: T1
, t2
: T2
, t3
: T3
) {
21 println
!("{:?}, {:?}, {:?}", t1
, t2
, t3
);
27 fn bar
<T
: Debug
>(&self, t
: T
) {
32 fn baz
<T
: Debug
>(t
: T
) {
38 fn do_it(args
: Self::Args
);
44 fn do_it(_
: Self::Args
) {}
49 type Args
= <A
as Tr
>::Args
;
51 fn do_it(args
: Self::Args
) {
69 taking_multiple_units(foo(0), foo(1));
70 taking_multiple_units(foo(0), {
74 taking_multiple_units(
84 // here Some(foo(2)) isn't the top level statement expression, wrap the suggestion in a block
85 None
.or(Some(foo(2)));
86 // in this case, the suggestion can be inlined, no need for a surrounding block
87 // foo(()); foo(()) instead of { foo(()); foo(()) }
95 foo3("a", 3, vec
![3]);
100 let named_unit_arg
= ();
106 fn question_mark() -> Result
<(), ()> {
114 fn unit_fn() -> Result
<(), i32> {
118 fn fallible() -> Result
<(), i32> {
124 fn returning_expr() -> Option
<()> {
128 fn taking_multiple_units(a
: (), b
: ()) {}