Skip to content

Commit aeda2a3

Browse files
committed
fix: remove incorrect use of ArrayProxy
1 parent 221d25b commit aeda2a3

File tree

3 files changed

+11
-32
lines changed

3 files changed

+11
-32
lines changed

src/generate/array_proxy.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@ pub struct ArrayProxy<T, const COUNT: usize, const STRIDE: usize> {
1515
}
1616

1717
impl<T, const C: usize, const S: usize> ArrayProxy<T, C, S> {
18-
/// Create a new ArrayProxy.
19-
#[inline(always)]
20-
#[allow(unused)]
21-
pub(crate) fn new() -> Self {
22-
Self {
23-
_array: marker::PhantomData,
24-
}
25-
}
2618
/// Get a reference from an [ArrayProxy] with no bounds checking.
2719
pub unsafe fn get_ref(&self, index: usize) -> &T {
2820
let base = self as *const Self as usize;

src/generate/device.rs

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -249,30 +249,17 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
249249
exprs.extend(quote!(#id: #id { _marker: PhantomData },));
250250
}
251251
Peripheral::Array(_p, dim_element) => {
252-
if config.const_generic {
253-
let p_name = util::name_of(p, config.ignore_groups);
254-
let p = p_name.to_sanitized_upper_case();
255-
let id = Ident::new(&p, Span::call_site());
256-
let dim = dim_element.dim as usize;
257-
let dim_increment = util::hex(dim_element.dim_increment as u64);
258-
fields.extend(quote! {
252+
let p_names: Vec<Cow<str>> = names(p, dim_element).map(|n| n.into()).collect();
253+
let p = p_names.iter().map(|p| p.to_sanitized_upper_case());
254+
let ids_f = p.clone().map(|p| Ident::new(&p, Span::call_site()));
255+
let ids_e = ids_f.clone();
256+
fields.extend(quote! {
257+
#(
259258
#[doc = #p]
260-
pub #id: crate::ArrayProxy<#id, #dim, #dim_increment>,
261-
});
262-
exprs.extend(quote!(#id: crate::ArrayProxy::new(),));
263-
} else {
264-
let p_names: Vec<Cow<str>> = names(p, dim_element).map(|n| n.into()).collect();
265-
let p = p_names.iter().map(|p| p.to_sanitized_upper_case());
266-
let ids_f = p.clone().map(|p| Ident::new(&p, Span::call_site()));
267-
let ids_e = ids_f.clone();
268-
fields.extend(quote! {
269-
#(
270-
#[doc = #p]
271-
pub #ids_f: #ids_f,
272-
)*
273-
});
274-
exprs.extend(quote!(#(#ids_e: #ids_e { _marker: PhantomData },)*));
275-
}
259+
pub #ids_f: #ids_f,
260+
)*
261+
});
262+
exprs.extend(quote!(#(#ids_e: #ids_e { _marker: PhantomData },)*));
276263
}
277264
}
278265
}

src/generate/peripheral.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub fn render(
5858
};
5959

6060
match p_original {
61-
Peripheral::Array(p, dim) if !config.const_generic => {
61+
Peripheral::Array(p, dim) => {
6262
let names: Vec<Cow<str>> = names(p, dim).map(|n| n.into()).collect();
6363
let names_str = names.iter().map(|n| n.to_sanitized_upper_case());
6464
let names_pc = names_str.clone().map(|n| Ident::new(&n, span));

0 commit comments

Comments
 (0)