]> git.lizzy.rs Git - rust.git/blobdiff - tests/target/fn.rs
Merge pull request #681 from rust-lang-nursery/comment-style
[rust.git] / tests / target / fn.rs
index dff8085136ee0e87cf07f558f806995f7e12437a..3157c2f9881a72d7cfc9c4c4aa4acf5672cc87ce 100644 (file)
@@ -1,8 +1,6 @@
 // Tests different fns
 
-fn foo(a: AAAA, b: BBB, c: CCC) -> RetType {
-
-}
+fn foo(a: AAAA, b: BBB, c: CCC) -> RetType {}
 
 fn foo(a: AAAA, b: BBB /* some, weird, inline comment */, c: CCC) -> RetType
     where T: Blah
@@ -34,17 +32,17 @@ fn foo<U, T>(a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
 
 }
 
+fn foo<U: Fn(A) -> B /* paren inside generics */>() {}
+
 impl Foo {
     fn with_no_errors<T, F>(&mut self, f: F) -> T
         where F: FnOnce(&mut Resolver) -> T
     {
     }
 
-    fn foo(mut self, mut bar: u32) {
-    }
+    fn foo(mut self, mut bar: u32) {}
 
-    fn bar(self, mut bazz: u32) {
-    }
+    fn bar(self, mut bazz: u32) {}
 }
 
 pub fn render<'a,
@@ -72,7 +70,24 @@ const fn foo() {
     }
 }
 
+fn homura<T: Deref<Target = i32>>(_: T) {}
+
+fn issue377() -> (Box<CompositorProxy + Send>, Box<CompositorReceiver>) {}
+
 fn main() {
     let _ = function(move || 5);
     let _ = move || 42;
+    let _ = || unsafe { abort() };
+}
+
+// With inner attributes.
+fn inner() {
+    #![inline]
+    x
+}
+
+#[cfg_attr(rustfmt, rustfmt_skip)]
+fn foo(a: i32) -> i32 {
+    // comment
+    if a > 0 { 1 } else { 2 }
 }