clippy::unused_unit,
clippy::unnecessary_wraps,
clippy::or_fun_call,
- clippy::needless_question_mark
+ clippy::needless_question_mark,
+ clippy::self_named_constructors
)]
use std::fmt::Debug;
}
}
+fn baz<T: Debug>(t: T) {
+ foo(t);
+}
+
+trait Tr {
+ type Args;
+ fn do_it(args: Self::Args);
+}
+
+struct A;
+impl Tr for A {
+ type Args = ();
+ fn do_it(_: Self::Args) {}
+}
+
+struct B;
+impl Tr for B {
+ type Args = <A as Tr>::Args;
+
+ fn do_it(args: Self::Args) {
+ A::do_it(args)
+ }
+}
+
fn bad() {
foo({
1;
// in this case, the suggestion can be inlined, no need for a surrounding block
// foo(()); foo(()) instead of { foo(()); foo(()) }
foo(foo(()));
- foo(if true {
- 1;
- });
- foo(match Some(1) {
- Some(_) => {
- 1;
- },
- None => {
- 0;
- },
- });
}
fn ok() {
question_mark();
let named_unit_arg = ();
foo(named_unit_arg);
- foo(if true { 1 } else { 0 });
- foo(match Some(1) {
- Some(_) => 1,
- None => 0,
- });
+ baz(());
+ B::do_it(());
}
fn question_mark() -> Result<(), ()> {