File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,24 @@ const EXPECTED = [
9
9
{ 'path' : 'trait_methods::MyTrait' , 'name' : 'next' } ,
10
10
] ,
11
11
} ,
12
+ // the traitParent deduplication pass should remove
13
+ // Empty::next, as it would be redundant
14
+ {
15
+ 'query' : 'next' ,
16
+ 'correction' : null ,
17
+ 'in_args' : [ ] ,
18
+ 'others' : [
19
+ { 'path' : 'trait_methods::MyTrait' , 'name' : 'next' } ,
20
+ ] ,
21
+ } ,
22
+ // if the trait does not match, no deduplication happens
23
+ {
24
+ 'query' : '-> option<()>' ,
25
+ 'correction' : null ,
26
+ 'in_args' : [ ] ,
27
+ 'others' : [
28
+ { 'path' : 'trait_methods::Empty' , 'name' : 'next' } ,
29
+ { 'path' : 'trait_methods::Void' , 'name' : 'next' } ,
30
+ ] ,
31
+ } ,
12
32
] ;
Original file line number Diff line number Diff line change @@ -2,3 +2,21 @@ pub trait MyTrait {
2
2
type Item ;
3
3
fn next ( & mut self ) -> Option < Self :: Item > ;
4
4
}
5
+
6
+ pub struct Empty ;
7
+
8
+ impl MyTrait for Empty {
9
+ type Item = ( ) ;
10
+ fn next ( & mut self ) -> Option < ( ) > {
11
+ None
12
+ }
13
+ }
14
+
15
+ pub struct Void ;
16
+
17
+ impl MyTrait for Void {
18
+ type Item = ( ) ;
19
+ fn next ( & mut self ) -> Option < ( ) > {
20
+ Some ( ( ) )
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments