Skip to content

Commit e4d8b85

Browse files
committed
Rename _pc_r/w to name_pc_r/w
Again, using an underscore prefix on a variable intended to be used subverts compiler and programmer expectations. In this case it's even more misleading, as the contained variable name does not itself start with an underscore.
1 parent dc710bd commit e4d8b85

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/generate/register.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ pub fn fields(
298298
String::from("Reader of field ") + &quotedfield
299299
};
300300

301-
let _pc_r = Ident::new(&(name_pc.clone() + "_R"), span);
301+
let name_pc_r = Ident::new(&(name_pc.clone() + "_R"), span);
302302

303303
let cast = if width == 1 {
304304
quote! { != 0 }
@@ -323,8 +323,8 @@ pub fn fields(
323323
r_impl_items.extend(quote! {
324324
#[doc = #doc]
325325
#inline
326-
pub unsafe fn #sc(&self, n: usize) -> #_pc_r {
327-
#_pc_r::new ( #value )
326+
pub unsafe fn #sc(&self, n: usize) -> #name_pc_r {
327+
#name_pc_r::new ( #value )
328328
}
329329
});
330330
for (i, suffix) in (0..*dim).zip(suffixes.iter()) {
@@ -350,8 +350,8 @@ pub fn fields(
350350
r_impl_items.extend(quote! {
351351
#[doc = #doc]
352352
#inline
353-
pub fn #sc_n(&self) -> #_pc_r {
354-
#_pc_r::new ( #value )
353+
pub fn #sc_n(&self) -> #name_pc_r {
354+
#name_pc_r::new ( #value )
355355
}
356356
});
357357
}
@@ -360,8 +360,8 @@ pub fn fields(
360360
r_impl_items.extend(quote! {
361361
#[doc = #doc]
362362
#inline
363-
pub fn #sc(&self) -> #_pc_r {
364-
#_pc_r::new ( #value )
363+
pub fn #sc(&self) -> #name_pc_r {
364+
#name_pc_r::new ( #value )
365365
}
366366
});
367367
}
@@ -377,7 +377,7 @@ pub fn fields(
377377

378378
mod_items.extend(quote! {
379379
#[doc = #readerdoc]
380-
pub type #_pc_r = crate::R<#fty, #name_pc_a>;
380+
pub type #name_pc_r = crate::R<#fty, #name_pc_a>;
381381
});
382382
} else {
383383
let has_reserved_variant = evs.values.len() != (1 << width);
@@ -459,23 +459,23 @@ pub fn fields(
459459

460460
mod_items.extend(quote! {
461461
#[doc = #readerdoc]
462-
pub type #_pc_r = crate::R<#fty, #name_pc_a>;
463-
impl #_pc_r {
462+
pub type #name_pc_r = crate::R<#fty, #name_pc_a>;
463+
impl #name_pc_r {
464464
#enum_items
465465
}
466466
});
467467
}
468468
} else {
469469
mod_items.extend(quote! {
470470
#[doc = #readerdoc]
471-
pub type #_pc_r = crate::R<#fty, #fty>;
471+
pub type #name_pc_r = crate::R<#fty, #fty>;
472472
})
473473
}
474474
}
475475

476476
if can_write {
477477
let new_pc_aw = Ident::new(&(name_pc.clone() + "_AW"), span);
478-
let _pc_w = Ident::new(&(name_pc.clone() + "_W"), span);
478+
let name_pc_w = Ident::new(&(name_pc.clone() + "_W"), span);
479479

480480
let mut proxy_items = TokenStream::new();
481481
let mut unsafety = unsafety(f.write_constraint.as_ref(), width);
@@ -595,12 +595,12 @@ pub fn fields(
595595

596596
mod_items.extend(quote! {
597597
#[doc = #doc]
598-
pub struct #_pc_w<'a> {
598+
pub struct #name_pc_w<'a> {
599599
w: &'a mut W,
600600
#offset_entry
601601
}
602602

603-
impl<'a> #_pc_w<'a> {
603+
impl<'a> #name_pc_w<'a> {
604604
#proxy_items
605605
}
606606
});
@@ -611,8 +611,8 @@ pub fn fields(
611611
w_impl_items.extend(quote! {
612612
#[doc = #doc]
613613
#inline
614-
pub unsafe fn #sc(&mut self, n: usize) -> #_pc_w {
615-
#_pc_w { w: self, offset: #offset_calc }
614+
pub unsafe fn #sc(&mut self, n: usize) -> #name_pc_w {
615+
#name_pc_w { w: self, offset: #offset_calc }
616616
}
617617
});
618618
for (i, suffix) in (0..*dim).zip(suffixes.iter()) {
@@ -629,8 +629,8 @@ pub fn fields(
629629
w_impl_items.extend(quote! {
630630
#[doc = #doc]
631631
#inline
632-
pub fn #sc_n(&mut self) -> #_pc_w {
633-
#_pc_w { w: self, offset: #sub_offset }
632+
pub fn #sc_n(&mut self) -> #name_pc_w {
633+
#name_pc_w { w: self, offset: #sub_offset }
634634
}
635635
});
636636
}
@@ -639,8 +639,8 @@ pub fn fields(
639639
w_impl_items.extend(quote! {
640640
#[doc = #doc]
641641
#inline
642-
pub fn #sc(&mut self) -> #_pc_w {
643-
#_pc_w { w: self }
642+
pub fn #sc(&mut self) -> #name_pc_w {
643+
#name_pc_w { w: self }
644644
}
645645
});
646646
}

0 commit comments

Comments
 (0)