This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +36
-3
lines changed Expand file tree Collapse file tree 4 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -1118,6 +1118,18 @@ pub(crate) fn format_trait(
1118
1118
}
1119
1119
}
1120
1120
1121
+ struct OpaqueTypeBounds < ' a > {
1122
+ generic_bounds : & ' a ast:: GenericBounds ,
1123
+ }
1124
+
1125
+ impl < ' a > Rewrite for OpaqueTypeBounds < ' a > {
1126
+ fn rewrite ( & self , context : & RewriteContext < ' _ > , shape : Shape ) -> Option < String > {
1127
+ self . generic_bounds
1128
+ . rewrite ( context, shape)
1129
+ . map ( |s| format ! ( "impl {}" , s) )
1130
+ }
1131
+ }
1132
+
1121
1133
pub ( crate ) struct TraitAliasBounds < ' a > {
1122
1134
generic_bounds : & ' a ast:: GenericBounds ,
1123
1135
generics : & ' a ast:: Generics ,
@@ -1524,13 +1536,14 @@ pub(crate) fn rewrite_opaque_type(
1524
1536
generics : & ast:: Generics ,
1525
1537
vis : & ast:: Visibility ,
1526
1538
) -> Option < String > {
1539
+ let opaque_type_bounds = OpaqueTypeBounds { generic_bounds } ;
1527
1540
rewrite_type_item (
1528
1541
context,
1529
1542
indent,
1530
1543
"type" ,
1531
1544
" =" ,
1532
1545
ident,
1533
- generic_bounds ,
1546
+ & opaque_type_bounds ,
1534
1547
generics,
1535
1548
vis,
1536
1549
)
Original file line number Diff line number Diff line change @@ -13,3 +13,11 @@ pub type Adderrr<T> = impl Fn( T ) -> T;
13
13
impl Foo for Bar {
14
14
type E = impl Trait ;
15
15
}
16
+
17
+ pub type Adder_without_impl < F , T >
18
+ where
19
+ T : Clone ,
20
+ F : Copy
21
+ = Fn ( T ) -> T ;
22
+
23
+ pub type Adderrr_without_impl < T > = Fn ( T ) -> T ;
Original file line number Diff line number Diff line change @@ -6,10 +6,18 @@ pub type Adder<F, T>
6
6
where
7
7
T : Clone ,
8
8
F : Copy ,
9
- = Fn ( T ) -> T ;
9
+ = impl Fn ( T ) -> T ;
10
10
11
- pub type Adderrr < T > = Fn ( T ) -> T ;
11
+ pub type Adderrr < T > = impl Fn ( T ) -> T ;
12
12
13
13
impl Foo for Bar {
14
14
type E = impl Trait ;
15
15
}
16
+
17
+ pub type Adder_without_impl < F , T >
18
+ where
19
+ T : Clone ,
20
+ F : Copy ,
21
+ = Fn ( T ) -> T ;
22
+
23
+ pub type Adderrr_without_impl < T > = Fn ( T ) -> T ;
Original file line number Diff line number Diff line change
1
+ pub type Type = impl Deref < Target = i8 > ;
2
+
3
+ pub type Type =
4
+ impl VeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeryLongType < Target = i8 > ;
You can’t perform that action at this time.
0 commit comments