@@ -81,12 +81,12 @@ use parse::ClangItemParser;
81
81
/// +------+----------------------+--------------------------+------------------------+----
82
82
/// |Decl. | self_template_params | num_self_template_params | all_template_parameters| ...
83
83
/// +------+----------------------+--------------------------+------------------------+----
84
- /// |Foo | [T, U] | 2 | Some( [T, U]) | ...
85
- /// |Bar | [V] | 1 | Some( [T, U, V]) | ...
86
- /// |Inner | [] | 0 | Some( [T, U]) | ...
87
- /// |Lol | [W] | 1 | Some( [T, U, W]) | ...
88
- /// |Wtf | [X] | 1 | Some( [T, U, X]) | ...
89
- /// |Qux | [] | 0 | None | ...
84
+ /// |Foo | [T, U] | 2 | [T, U] | ...
85
+ /// |Bar | [V] | 1 | [T, U, V] | ...
86
+ /// |Inner | [] | 0 | [T, U] | ...
87
+ /// |Lol | [W] | 1 | [T, U, W] | ...
88
+ /// |Wtf | [X] | 1 | [T, U, X] | ...
89
+ /// |Qux | [] | 0 | [] | ...
90
90
/// +------+----------------------+--------------------------+------------------------+----
91
91
///
92
92
/// ----+------+-----+----------------------+
@@ -131,19 +131,14 @@ pub trait TemplateParameters {
131
131
/// how we would fully reference such a member type in C++:
132
132
/// `Foo<int,char>::Inner`. `Foo` *must* be instantiated with template
133
133
/// arguments before we can gain access to the `Inner` member type.
134
- fn all_template_params ( & self , ctx : & BindgenContext ) -> Option < Vec < TypeId > >
134
+ fn all_template_params ( & self , ctx : & BindgenContext ) -> Vec < TypeId >
135
135
where
136
136
Self : ItemAncestors ,
137
137
{
138
138
let ancestors: Vec < _ > = self . ancestors ( ctx) . collect ( ) ;
139
- let all_template_params : Vec < _ > = ancestors. into_iter ( ) . rev ( ) . flat_map ( |id| {
139
+ ancestors. into_iter ( ) . rev ( ) . flat_map ( |id| {
140
140
id. self_template_params ( ctx) . into_iter ( )
141
- } ) . collect ( ) ;
142
- if all_template_params. len ( ) > 0 {
143
- Some ( all_template_params)
144
- } else {
145
- None
146
- }
141
+ } ) . collect ( )
147
142
}
148
143
149
144
/// Get only the set of template parameters that this item uses. This is a
@@ -159,14 +154,14 @@ pub trait TemplateParameters {
159
154
) ;
160
155
161
156
let id = * self . as_ref ( ) ;
162
- ctx. resolve_item ( id) . all_template_params ( ctx) . map (
163
- |all_params| {
164
- all_params
165
- . into_iter ( )
166
- . filter ( |p| ctx . uses_template_parameter ( id , * p ) )
167
- . collect ( )
168
- } ,
169
- )
157
+ let all_template_params : Vec < _ > = ctx. resolve_item ( id) . all_template_params ( ctx) ;
158
+ if all_template_params . len ( ) > 0 {
159
+ Some ( all_template_params . into_iter ( )
160
+ . filter ( |p| ctx . uses_template_parameter ( id , * p ) )
161
+ . collect ( ) )
162
+ } else {
163
+ None
164
+ }
170
165
}
171
166
}
172
167
0 commit comments