1
1
use super :: DEFAULT_FUNC ;
2
2
3
3
use std:: fmt;
4
+ use thin_vec:: ThinVec ;
4
5
5
6
use rustc_ast:: ast;
6
7
use rustc_ast_pretty:: pprust:: ty_to_string;
@@ -12,9 +13,9 @@ use crate::dot::escape_html;
12
13
13
14
#[ derive( Default , Debug , Clone , Eq , PartialEq ) ]
14
15
pub struct Implem {
15
- ty : Vec < ( symbol:: Symbol , Vec < String > ) > ,
16
+ ty : ThinVec < ( symbol:: Symbol , Vec < String > ) > ,
16
17
/// method's name, arguments, result.
17
- method : Vec < ( symbol:: Symbol , Vec < String > , Option < String > ) > ,
18
+ method : ThinVec < ( symbol:: Symbol , Vec < String > , Option < String > ) > ,
18
19
}
19
20
20
21
impl Implem {
@@ -49,14 +50,14 @@ impl Implem {
49
50
50
51
impl
51
52
From < (
52
- Vec < ( symbol:: Symbol , Vec < String > ) > ,
53
- Vec < ( symbol:: Symbol , Vec < String > , Option < String > ) > ,
53
+ ThinVec < ( symbol:: Symbol , Vec < String > ) > ,
54
+ ThinVec < ( symbol:: Symbol , Vec < String > , Option < String > ) > ,
54
55
) > for Implem
55
56
{
56
57
fn from (
57
58
( ty, method) : (
58
- Vec < ( symbol:: Symbol , Vec < String > ) > ,
59
- Vec < ( symbol:: Symbol , Vec < String > , Option < String > ) > ,
59
+ ThinVec < ( symbol:: Symbol , Vec < String > ) > ,
60
+ ThinVec < ( symbol:: Symbol , Vec < String > , Option < String > ) > ,
60
61
) ,
61
62
) -> Implem {
62
63
Implem {
66
67
}
67
68
}
68
69
69
- impl < ' a > From < ( & ' a Vec < ast:: PathSegment > , & ' a Vec < ast:: Item > ) > for Implem {
70
- fn from ( ( segments, impl_item) : ( & ' a Vec < ast:: PathSegment > , & ' a Vec < ast:: Item > ) ) -> Implem {
70
+ impl < ' a > From < ( & ' a ThinVec < ast:: PathSegment > , & ' a ThinVec < ast:: Item > ) > for Implem {
71
+ fn from ( ( segments, impl_item) : ( & ' a ThinVec < ast:: PathSegment > , & ' a ThinVec < ast:: Item > ) ) -> Implem {
71
72
Implem :: from ( (
72
73
segments
73
74
. iter ( )
@@ -91,7 +92,7 @@ impl<'a> From<(&'a Vec<ast::PathSegment>, &'a Vec<ast::Item>)> for Implem {
91
92
// }
92
93
} ,
93
94
)
94
- . collect :: < Vec < ( symbol:: Symbol , Vec < String > ) > > ( ) ,
95
+ . collect :: < ThinVec < ( symbol:: Symbol , Vec < String > ) > > ( ) ,
95
96
impl_item
96
97
. iter ( )
97
98
. flat_map (
@@ -137,13 +138,13 @@ impl<'a> From<(&'a Vec<ast::PathSegment>, &'a Vec<ast::Item>)> for Implem {
137
138
None
138
139
}
139
140
} )
140
- . collect :: < Vec < ( symbol:: Symbol , Vec < String > , Option < String > ) > > ( )
141
+ . collect :: < ThinVec < ( symbol:: Symbol , Vec < String > , Option < String > ) > > ( )
141
142
} else {
142
- vec ! [ ]
143
+ ThinVec :: new ( )
143
144
}
144
145
} ,
145
146
)
146
- . collect :: < Vec < ( symbol:: Symbol , Vec < String > , Option < String > ) > > ( ) ,
147
+ . collect :: < ThinVec < ( symbol:: Symbol , Vec < String > , Option < String > ) > > ( ) ,
147
148
) )
148
149
}
149
150
}
0 commit comments