3 // The output for humans should just highlight the whole span without showing
4 // the suggested replacement, but we also want to test that suggested
5 // replacement only removes one set of parentheses, rather than naïvely
6 // stripping away any starting or ending parenthesis characters—hence this
7 // test of the JSON error format.
9 #![feature(custom_inner_attributes)]
10 #![feature(closure_lifetime_binder)]
13 #![deny(clippy::unused_unit)]
15 #![allow(clippy::from_over_into)]
19 #[allow(clippy::no_effect)]
20 pub fn get_unit<F: Fn() -> (), G>(&self, f: F, _g: G) -> ()
22 let _y: &dyn Fn() -> () = &f;
23 (); // this should not lint, as it's not in return type position
27 impl Into<()> for Unitter {
35 fn redundant<F: FnOnce() -> (), G, H>(&self, _f: F, _g: G, _h: H)
41 impl Trait for Unitter {
42 fn redundant<F: FnOnce() -> (), G, H>(&self, _f: F, _g: G, _h: H)
48 fn return_unit() -> () { () }
50 #[allow(clippy::needless_return)]
51 #[allow(clippy::never_loop)]
52 #[allow(clippy::unit_cmp)]
55 assert_eq!(u.get_unit(|| {}, return_unit), u.into());
63 // https://github.com/rust-lang/rust-clippy/issues/4076
66 (recv($r:expr) -> $res:pat => $body:expr) => {
94 let _ = for<'a> |_: &'a u32| -> () {};