@@ -78,13 +78,13 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
78
78
/// no stolen instances are passed to such software.
79
79
} ;
80
80
81
- let per_to_tokens = |feature_attribute : & TokenStream ,
81
+ let per_to_tokens = |out : & mut TokenStream ,
82
+ feature_attribute : & TokenStream ,
82
83
description : & str ,
83
84
p_ty : & Ident ,
84
85
doc_alias : Option < TokenStream > ,
85
- address : LitInt |
86
- -> TokenStream {
87
- let mut tokens = if config. raw_access {
86
+ address : LitInt | {
87
+ out. extend ( if config. raw_access {
88
88
quote ! {
89
89
#[ doc = #description]
90
90
#doc_alias
@@ -149,16 +149,15 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
149
149
}
150
150
}
151
151
}
152
- } ;
153
- tokens . extend ( quote ! {
152
+ } ) ;
153
+ out . extend ( quote ! {
154
154
#feature_attribute
155
155
impl core:: fmt:: Debug for #p_ty {
156
156
fn fmt( & self , f: & mut core:: fmt:: Formatter ) -> core:: fmt:: Result {
157
157
f. debug_struct( #name_str) . finish( )
158
158
}
159
159
}
160
160
} ) ;
161
- tokens
162
161
} ;
163
162
164
163
match & p {
@@ -178,13 +177,14 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
178
177
feature_attribute_n. extend ( quote ! { #[ cfg( feature = #p_feature) ] } )
179
178
} ;
180
179
// Insert the peripherals structure
181
- out. extend ( per_to_tokens (
180
+ per_to_tokens (
181
+ & mut out,
182
182
& feature_attribute_n,
183
183
description,
184
184
& p_ty,
185
185
doc_alias,
186
186
address,
187
- ) ) ;
187
+ ) ;
188
188
}
189
189
190
190
let feature_any_attribute = quote ! { #[ cfg( any( #( feature = #feature_names) , * ) ) ] } ;
@@ -207,13 +207,14 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
207
207
feature_attribute. extend ( quote ! { #[ cfg( feature = #p_feature) ] } )
208
208
} ;
209
209
// Insert the peripheral structure
210
- out. extend ( per_to_tokens (
210
+ per_to_tokens (
211
+ & mut out,
211
212
& feature_attribute,
212
213
& description,
213
214
& p_ty,
214
215
None ,
215
216
address,
216
- ) ) ;
217
+ ) ;
217
218
218
219
// Derived peripherals may not require re-implementation, and will instead
219
220
// use a single definition of the non-derived version.
0 commit comments