@@ -78,13 +78,13 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
7878 /// no stolen instances are passed to such software.
7979 } ;
8080
81- let per_to_tokens = |feature_attribute : & TokenStream ,
81+ let per_to_tokens = |out : & mut TokenStream ,
82+ feature_attribute : & TokenStream ,
8283 description : & str ,
8384 p_ty : & Ident ,
8485 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 {
8888 quote ! {
8989 #[ doc = #description]
9090 #doc_alias
@@ -149,16 +149,15 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
149149 }
150150 }
151151 }
152- } ;
153- tokens . extend ( quote ! {
152+ } ) ;
153+ out . extend ( quote ! {
154154 #feature_attribute
155155 impl core:: fmt:: Debug for #p_ty {
156156 fn fmt( & self , f: & mut core:: fmt:: Formatter ) -> core:: fmt:: Result {
157157 f. debug_struct( #name_str) . finish( )
158158 }
159159 }
160160 } ) ;
161- tokens
162161 } ;
163162
164163 match & p {
@@ -178,13 +177,14 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
178177 feature_attribute_n. extend ( quote ! { #[ cfg( feature = #p_feature) ] } )
179178 } ;
180179 // Insert the peripherals structure
181- out. extend ( per_to_tokens (
180+ per_to_tokens (
181+ & mut out,
182182 & feature_attribute_n,
183183 description,
184184 & p_ty,
185185 doc_alias,
186186 address,
187- ) ) ;
187+ ) ;
188188 }
189189
190190 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
207207 feature_attribute. extend ( quote ! { #[ cfg( feature = #p_feature) ] } )
208208 } ;
209209 // Insert the peripheral structure
210- out. extend ( per_to_tokens (
210+ per_to_tokens (
211+ & mut out,
211212 & feature_attribute,
212213 & description,
213214 & p_ty,
214215 None ,
215216 address,
216- ) ) ;
217+ ) ;
217218
218219 // Derived peripherals may not require re-implementation, and will instead
219220 // use a single definition of the non-derived version.
0 commit comments