@@ -3,7 +3,6 @@ use proc_macro2::{Span, TokenStream};
33use quote:: { quote, ToTokens } ;
44
55use log:: debug;
6- use std:: borrow:: Cow ;
76use std:: fs:: File ;
87use std:: io:: Write ;
98use std:: path:: Path ;
@@ -247,33 +246,20 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
247246 } ) ;
248247 exprs. extend ( quote ! ( #feature_attribute #p_ty: #p_ty { _marker: PhantomData } , ) ) ;
249248 }
250- Peripheral :: Array ( _p, dim_element) => {
251- let p_names: Vec < Cow < str > > = names ( p, dim_element) . map ( |n| n. into ( ) ) . collect ( ) ;
252- let ids_f = p_names
253- . iter ( )
254- . map ( |p| ident ( p, & config. ident_formats . peripheral , span) ) ;
255- let ids_e = ids_f. clone ( ) ;
256- let feature_attribute = p_names
257- . iter ( )
258- . map ( |p_name| {
259- let p_snake = p_name. to_sanitized_snake_case ( ) ;
260- let mut feature_attribute = feature_attribute. clone ( ) ;
261- if config. feature_peripheral {
262- feature_attribute. extend ( quote ! { #[ cfg( feature = #p_snake) ] } )
263- } ;
264- feature_attribute
265- } )
266- . collect :: < Vec < _ > > ( ) ;
267- fields. extend ( quote ! {
268- #(
269- #[ doc = #p_names]
249+ Peripheral :: Array ( p, dim_element) => {
250+ for p_name in names ( p, dim_element) {
251+ let p_snake = p_name. to_sanitized_snake_case ( ) ;
252+ let p_ty = ident ( & p_name, & config. ident_formats . peripheral , span) ;
253+ if config. feature_peripheral {
254+ feature_attribute. extend ( quote ! { #[ cfg( feature = #p_snake) ] } )
255+ } ;
256+ fields. extend ( quote ! {
257+ #[ doc = #p_name]
270258 #feature_attribute
271- pub #ids_f: #ids_f,
272- ) *
273- } ) ;
274- exprs. extend (
275- quote ! ( #( #feature_attribute #ids_e: #ids_e { _marker: PhantomData } , ) * ) ,
276- ) ;
259+ pub #p_ty: #p_ty,
260+ } ) ;
261+ exprs. extend ( quote ! ( #feature_attribute #p_ty: #p_ty { _marker: PhantomData } , ) ) ;
262+ }
277263 }
278264 }
279265 }
0 commit comments