]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/unused_unit.rs
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
[rust.git] / tests / ui / unused_unit.rs
index 8fc072ebd69f848ffc41dd09306febf07e459a96..e2c6afb020f5887dc175b3f8a832fb8293173637 100644 (file)
 
 struct Unitter;
 impl Unitter {
-    // try to disorient the lint with multiple unit returns and newlines
     #[allow(clippy::no_effect)]
-    pub fn get_unit<F: Fn() -> (), G>(&self, f: F, _g: G) ->
-        ()
+    pub fn get_unit<F: Fn() -> (), G>(&self, f: F, _g: G) -> ()
     where G: Fn() -> () {
         let _y: &dyn Fn() -> () = &f;
         (); // this should not lint, as it's not in return type position
@@ -31,6 +29,20 @@ fn into(self) -> () {
     }
 }
 
+trait Trait {
+    fn redundant<F: FnOnce() -> (), G, H>(&self, _f: F, _g: G, _h: H)
+    where
+        G: FnMut() -> (),
+        H: Fn() -> ();
+}
+
+impl Trait for Unitter {
+    fn redundant<F: FnOnce() -> (), G, H>(&self, _f: F, _g: G, _h: H)
+    where
+        G: FnMut() -> (),
+        H: Fn() -> () {}
+}
+
 fn return_unit() -> () { () }
 
 #[allow(clippy::needless_return)]