about summary refs log tree commit diff
path: root/tests/target
diff options
context:
space:
mode:
Diffstat (limited to 'tests/target')
-rw-r--r--tests/target/big-impl-rfc.rs77
-rw-r--r--tests/target/big-impl.rs62
-rw-r--r--tests/target/configs-control_style-rfc.rs17
-rw-r--r--tests/target/configs-fn_args_layout-block.rs11
-rw-r--r--tests/target/configs-fn_call_style-block-trailing-comma.rs4
-rw-r--r--tests/target/configs-fn_call_style-block.rs7
-rw-r--r--tests/target/configs-generics_indent-block.rs2
-rw-r--r--tests/target/fn-custom-2.rs6
-rw-r--r--tests/target/fn-custom-3.rs6
-rw-r--r--tests/target/impls.rs36
-rw-r--r--tests/target/match.rs4
11 files changed, 220 insertions, 12 deletions
diff --git a/tests/target/big-impl-rfc.rs b/tests/target/big-impl-rfc.rs
new file mode 100644
index 00000000000..108968faaed
--- /dev/null
+++ b/tests/target/big-impl-rfc.rs
@@ -0,0 +1,77 @@
+// rustfmt-fn_args_layout: Block
+// rustfmt-fn_call_style: Block
+// rustfmt-generics_indent: Block
+// rustfmt-where_style: Rfc
+
+// #1357
+impl<'a, Select, From, Distinct, Where, Order, Limit, Offset, Groupby, DB> InternalBoxedDsl<'a, DB>
+    for SelectStatement<Select, From, Distinct, Where, Order, Limit, Offset, GroupBy>
+where
+    DB: Backend,
+    Select: QueryFragment<DB> + SelectableExpression<From> + 'a,
+    Distinct: QueryFragment<DB> + 'a,
+    Where: Into<Option<Box<QueryFragment<DB> + 'a>>>,
+    Order: QueryFragment<DB> + 'a,
+    Limit: QueryFragment<DB> + 'a,
+    Offset: QueryFragment<DB> + 'a,
+{
+    type Output = BoxedSelectStatement<'a, Select::SqlTypeForSelect, From, DB>;
+
+    fn internal_into_boxed(self) -> Self::Output {
+        BoxedSelectStatement::new(
+            Box::new(self.select),
+            self.from,
+            Box::new(self.distinct),
+            self.where_clause.into(),
+            Box::new(self.order),
+            Box::new(self.limit),
+            Box::new(self.offset),
+        )
+    }
+}
+
+// #1369
+impl<ExcessivelyLongGenericName, ExcessivelyLongGenericName, AnotherExcessivelyLongGenericName> Foo
+    for Bar {
+    fn foo() {}
+}
+impl Foo<ExcessivelyLongGenericName, ExcessivelyLongGenericName, AnotherExcessivelyLongGenericName>
+    for Bar {
+    fn foo() {}
+}
+impl<
+    ExcessivelyLongGenericName,
+    ExcessivelyLongGenericName,
+    AnotherExcessivelyLongGenericName,
+> Foo<ExcessivelyLongGenericName, ExcessivelyLongGenericName, AnotherExcessivelyLongGenericName>
+    for Bar {
+    fn foo() {}
+}
+impl<ExcessivelyLongGenericName, ExcessivelyLongGenericName, AnotherExcessivelyLongGenericName> Foo
+    for Bar<
+        ExcessivelyLongGenericName,
+        ExcessivelyLongGenericName,
+        AnotherExcessivelyLongGenericName,
+    > {
+    fn foo() {}
+}
+impl Foo<ExcessivelyLongGenericName, ExcessivelyLongGenericName, AnotherExcessivelyLongGenericName>
+    for Bar<
+        ExcessivelyLongGenericName,
+        ExcessivelyLongGenericName,
+        AnotherExcessivelyLongGenericName,
+    > {
+    fn foo() {}
+}
+impl<
+    ExcessivelyLongGenericName,
+    ExcessivelyLongGenericName,
+    AnotherExcessivelyLongGenericName,
+> Foo<ExcessivelyLongGenericName, ExcessivelyLongGenericName, AnotherExcessivelyLongGenericName>
+    for Bar<
+        ExcessivelyLongGenericName,
+        ExcessivelyLongGenericName,
+        AnotherExcessivelyLongGenericName,
+    > {
+    fn foo() {}
+}
diff --git a/tests/target/big-impl.rs b/tests/target/big-impl.rs
new file mode 100644
index 00000000000..afe2571ec68
--- /dev/null
+++ b/tests/target/big-impl.rs
@@ -0,0 +1,62 @@
+// #1357
+impl<'a, Select, From, Distinct, Where, Order, Limit, Offset, Groupby, DB> InternalBoxedDsl<'a, DB>
+    for SelectStatement<Select, From, Distinct, Where, Order, Limit, Offset, GroupBy>
+    where DB: Backend,
+          Select: QueryFragment<DB> + SelectableExpression<From> + 'a,
+          Distinct: QueryFragment<DB> + 'a,
+          Where: Into<Option<Box<QueryFragment<DB> + 'a>>>,
+          Order: QueryFragment<DB> + 'a,
+          Limit: QueryFragment<DB> + 'a,
+          Offset: QueryFragment<DB> + 'a
+{
+    type Output = BoxedSelectStatement<'a, Select::SqlTypeForSelect, From, DB>;
+
+    fn internal_into_boxed(self) -> Self::Output {
+        BoxedSelectStatement::new(Box::new(self.select),
+                                  self.from,
+                                  Box::new(self.distinct),
+                                  self.where_clause.into(),
+                                  Box::new(self.order),
+                                  Box::new(self.limit),
+                                  Box::new(self.offset))
+    }
+}
+
+// #1369
+impl<ExcessivelyLongGenericName, ExcessivelyLongGenericName, AnotherExcessivelyLongGenericName> Foo
+    for Bar {
+    fn foo() {}
+}
+impl Foo<ExcessivelyLongGenericName, ExcessivelyLongGenericName, AnotherExcessivelyLongGenericName>
+    for Bar {
+    fn foo() {}
+}
+impl<ExcessivelyLongGenericName,
+     ExcessivelyLongGenericName,
+     AnotherExcessivelyLongGenericName> Foo<ExcessivelyLongGenericName,
+                                            ExcessivelyLongGenericName,
+                                            AnotherExcessivelyLongGenericName> for Bar {
+    fn foo() {}
+}
+impl<ExcessivelyLongGenericName, ExcessivelyLongGenericName, AnotherExcessivelyLongGenericName> Foo
+    for Bar<ExcessivelyLongGenericName,
+            ExcessivelyLongGenericName,
+            AnotherExcessivelyLongGenericName> {
+    fn foo() {}
+}
+impl Foo<ExcessivelyLongGenericName, ExcessivelyLongGenericName, AnotherExcessivelyLongGenericName>
+    for Bar<ExcessivelyLongGenericName,
+            ExcessivelyLongGenericName,
+            AnotherExcessivelyLongGenericName> {
+    fn foo() {}
+}
+impl<ExcessivelyLongGenericName,
+     ExcessivelyLongGenericName,
+     AnotherExcessivelyLongGenericName> Foo<ExcessivelyLongGenericName,
+                                            ExcessivelyLongGenericName,
+                                            AnotherExcessivelyLongGenericName>
+    for Bar<ExcessivelyLongGenericName,
+            ExcessivelyLongGenericName,
+            AnotherExcessivelyLongGenericName> {
+    fn foo() {}
+}
diff --git a/tests/target/configs-control_style-rfc.rs b/tests/target/configs-control_style-rfc.rs
index a7213c34dfb..43a10e92339 100644
--- a/tests/target/configs-control_style-rfc.rs
+++ b/tests/target/configs-control_style-rfc.rs
@@ -21,3 +21,20 @@ fn main() {
         }
     }
 }
+
+fn issue1656() {
+    {
+        {
+            match rewrite {
+                Some(ref body_str)
+                    if (!body_str.contains('\n') && body_str.len() <= arm_shape.width) ||
+                           !context.config.wrap_match_arms() ||
+                           (extend && first_line_width(body_str) <= arm_shape.width) ||
+                           is_block => {
+                    return None;
+                }
+                _ => {}
+            }
+        }
+    }
+}
diff --git a/tests/target/configs-fn_args_layout-block.rs b/tests/target/configs-fn_args_layout-block.rs
index 04a4d631ca4..f93b84f2d4a 100644
--- a/tests/target/configs-fn_args_layout-block.rs
+++ b/tests/target/configs-fn_args_layout-block.rs
@@ -32,3 +32,14 @@ extern "C" {
         ...
     );
 }
+
+// #1652
+fn deconstruct(
+    foo: Bar,
+) -> (SocketAddr,
+      Header,
+      Method,
+      RequestUri,
+      HttpVersion,
+      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) {
+}
diff --git a/tests/target/configs-fn_call_style-block-trailing-comma.rs b/tests/target/configs-fn_call_style-block-trailing-comma.rs
index ebdf41d0e3b..b6eb94eb677 100644
--- a/tests/target/configs-fn_call_style-block-trailing-comma.rs
+++ b/tests/target/configs-fn_call_style-block-trailing-comma.rs
@@ -3,7 +3,9 @@
 
 // rustfmt should not add trailing comma when rewriting macro. See #1528.
 fn a() {
-    panic!("this is a long string that goes past the maximum line length causing rustfmt to insert a comma here:");
+    panic!(
+        "this is a long string that goes past the maximum line length causing rustfmt to insert a comma here:"
+    );
     foo(
         oooptoptoptoptptooptoptoptoptptooptoptoptoptptoptoptoptoptpt(),
     );
diff --git a/tests/target/configs-fn_call_style-block.rs b/tests/target/configs-fn_call_style-block.rs
index ddead8ce5a8..dfc8daef6d9 100644
--- a/tests/target/configs-fn_call_style-block.rs
+++ b/tests/target/configs-fn_call_style-block.rs
@@ -145,3 +145,10 @@ fn issue1581() {
         }
     });
 }
+
+fn issue1651() {
+    {
+        let type_list: Vec<_> =
+            try_opt!(types.iter().map(|ty| ty.rewrite(context, shape)).collect());
+    }
+}
diff --git a/tests/target/configs-generics_indent-block.rs b/tests/target/configs-generics_indent-block.rs
index 789243c02c3..848e59c7c0a 100644
--- a/tests/target/configs-generics_indent-block.rs
+++ b/tests/target/configs-generics_indent-block.rs
@@ -8,7 +8,7 @@ fn lorem<
     Amet: Eq = usize,
     Adipiscing: Eq = usize,
     Consectetur: Eq = usize,
-    Elit: Eq = usize
+    Elit: Eq = usize,
 >(ipsum: Ipsum,
     dolor: Dolor,
     sit: Sit,
diff --git a/tests/target/fn-custom-2.rs b/tests/target/fn-custom-2.rs
index e9ba39f666c..f0923bd1a85 100644
--- a/tests/target/fn-custom-2.rs
+++ b/tests/target/fn-custom-2.rs
@@ -16,7 +16,7 @@ fn foo(
 fn bar<
     'a: 'bbbbbbbbbbbbbbbbbbbbbbbbbbb,
     TTTTTTTTTTTTT,
-    UUUUUUUUUUUUUUUUUUUU: WWWWWWWWWWWWWWWWWWWWWWWW
+    UUUUUUUUUUUUUUUUUUUU: WWWWWWWWWWWWWWWWWWWWWWWW,
 >(
     a: Aaaaaaaaaaaaaaa,
 ) {
@@ -51,7 +51,7 @@ impl Foo {
     fn bar<
         'a: 'bbbbbbbbbbbbbbbbbbbbbbbbbbb,
         TTTTTTTTTTTTT,
-        UUUUUUUUUUUUUUUUUUUU: WWWWWWWWWWWWWWWWWWWWWWWW
+        UUUUUUUUUUUUUUUUUUUU: WWWWWWWWWWWWWWWWWWWWWWWW,
     >(
         a: Aaaaaaaaaaaaaaa,
     ) {
@@ -69,7 +69,7 @@ struct Foo<
     TTTTTTTTTTTTTTTTTTTTTTTTTTTT,
     UUUUUUUUUUUUUUUUUUUUUU,
     VVVVVVVVVVVVVVVVVVVVVVVVVVV,
-    WWWWWWWWWWWWWWWWWWWWWWWW
+    WWWWWWWWWWWWWWWWWWWWWWWW,
 > {
     foo: Foo,
 }
diff --git a/tests/target/fn-custom-3.rs b/tests/target/fn-custom-3.rs
index a29aac411ba..4d26c9b6951 100644
--- a/tests/target/fn-custom-3.rs
+++ b/tests/target/fn-custom-3.rs
@@ -16,7 +16,7 @@ fn foo(
 fn bar<
     'a: 'bbbbbbbbbbbbbbbbbbbbbbbbbbb,
     TTTTTTTTTTTTT,
-    UUUUUUUUUUUUUUUUUUUU: WWWWWWWWWWWWWWWWWWWWWWWW
+    UUUUUUUUUUUUUUUUUUUU: WWWWWWWWWWWWWWWWWWWWWWWW,
 >(
     a: Aaaaaaaaaaaaaaa,
 ) {
@@ -53,7 +53,7 @@ impl Foo {
     fn bar<
         'a: 'bbbbbbbbbbbbbbbbbbbbbbbbbbb,
         TTTTTTTTTTTTT,
-        UUUUUUUUUUUUUUUUUUUU: WWWWWWWWWWWWWWWWWWWWWWWW
+        UUUUUUUUUUUUUUUUUUUU: WWWWWWWWWWWWWWWWWWWWWWWW,
     >(
         a: Aaaaaaaaaaaaaaa,
     ) {
@@ -65,7 +65,7 @@ struct Foo<
     TTTTTTTTTTTTTTTTTTTTTTTTTTTT,
     UUUUUUUUUUUUUUUUUUUUUU,
     VVVVVVVVVVVVVVVVVVVVVVVVVVV,
-    WWWWWWWWWWWWWWWWWWWWWWWW
+    WWWWWWWWWWWWWWWWWWWWWWWW,
 > {
     foo: Foo,
 }
diff --git a/tests/target/impls.rs b/tests/target/impls.rs
index f8b9f43aeb0..654d4be8967 100644
--- a/tests/target/impls.rs
+++ b/tests/target/impls.rs
@@ -126,8 +126,8 @@ mod m {
     impl<T> PartialEq for S<T> where T: PartialEq {}
 }
 
-impl<BorrowType, K, V, NodeType, HandleType> Handle<NodeRef<BorrowType, K, V, NodeType>,
-                                                    HandleType> {
+impl<BorrowType, K, V, NodeType, HandleType>
+    Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType> {
 }
 
 impl<BorrowType, K, V, NodeType, HandleType> PartialEq
@@ -154,3 +154,35 @@ impl<ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNodeFoo>
 impl<#[may_dangle] K, #[may_dangle] V> Drop for RawTable<K, V> {
     fn drop() {}
 }
+
+// #1168
+pub trait Number
+    : Copy
+    + Eq
+    + Not<Output = Self>
+    + Shl<u8, Output = Self>
+    + Shr<u8, Output = Self>
+    + BitAnd<Self, Output = Self>
+    + BitOr<Self, Output = Self>
+    + BitAndAssign
+    + BitOrAssign {
+    // test
+    fn zero() -> Self;
+}
+
+// #1642
+pub trait SomeTrait
+    : Clone
+    + Eq
+    + PartialEq
+    + Ord
+    + PartialOrd
+    + Default
+    + Hash
+    + Debug
+    + Display
+    + Write
+    + Read
+    + FromStr {
+    // comment
+}
diff --git a/tests/target/match.rs b/tests/target/match.rs
index 6acab043e67..45f62ca6845 100644
--- a/tests/target/match.rs
+++ b/tests/target/match.rs
@@ -306,8 +306,8 @@ fn guards() {
                                                                       barrrrrrrrrrrr => {}
         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
             if fooooooooooooooooooooo &&
-               (bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ||
-                cccccccccccccccccccccccccccccccccccccccc) => {}
+               (bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb || cccccccccccccccccccccccccccccccccccccccc) => {
+        }
     }
 }