about summary refs log tree commit diff
path: root/tests/source
diff options
context:
space:
mode:
authorNick Cameron <nrc@ncameron.org>2017-06-13 11:55:33 +1200
committerGitHub <noreply@github.com>2017-06-13 11:55:33 +1200
commitc07925f4989416ab9325714e97a4f3da5cb600d2 (patch)
treef36d48968b377edf5cf01ab923afa4034a2f3b30 /tests/source
parent6ed3077651f6e6672df922181a7f5ce5289c74e1 (diff)
parent62e9473d07ec9a35e1c1e63140381055d86bb478 (diff)
Merge pull request #1647 from topecongiro/refactor-impl-format
Refactor impl format
Diffstat (limited to 'tests/source')
-rw-r--r--tests/source/big-impl-rfc.rs114
-rw-r--r--tests/source/big-impl.rs104
-rw-r--r--tests/source/impls.rs17
3 files changed, 235 insertions, 0 deletions
diff --git a/tests/source/big-impl-rfc.rs b/tests/source/big-impl-rfc.rs
new file mode 100644
index 00000000000..167f654cc43
--- /dev/null
+++ b/tests/source/big-impl-rfc.rs
@@ -0,0 +1,114 @@
+// 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/source/big-impl.rs b/tests/source/big-impl.rs
new file mode 100644
index 00000000000..c36b7e6cadb
--- /dev/null
+++ b/tests/source/big-impl.rs
@@ -0,0 +1,104 @@
+// #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/source/impls.rs b/tests/source/impls.rs
index 1c38a2ff284..17588fb9d35 100644
--- a/tests/source/impls.rs
+++ b/tests/source/impls.rs
@@ -122,3 +122,20 @@ impl<ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNodeFoo> Issue1249<ConcreteTh
 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
+}