Skip to content

Commit f9e048d

Browse files
committed
Do not underscore-prefix referenced variables
Using an underscore prefix on the name of variable holding an underscore-prefixed name is a cute convention, but it subverts the expectations of programmers as well as the compiler's unused-variable checks. This changes such references to use the convention `u_` to indicate an underscore-prefixed name instead.
1 parent 3d1d618 commit f9e048d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/generate/register.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn render(
2121
let name = util::name_of(register);
2222
let span = Span::call_site();
2323
let name_pc = Ident::new(&name.to_sanitized_upper_case(), span);
24-
let _name_pc = Ident::new(&format!("_{}", &name.to_sanitized_upper_case()), span);
24+
let u_name_pc = Ident::new(&format!("_{}", &name.to_sanitized_upper_case()), span);
2525
let name_sc = Ident::new(&name.to_sanitized_snake_case(), span);
2626
let rsize = register
2727
.size
@@ -152,11 +152,11 @@ pub fn render(
152152
}
153153
out.extend(quote! {
154154
#[doc = #doc]
155-
pub type #name_pc = crate::Reg<#rty, #_name_pc>;
155+
pub type #name_pc = crate::Reg<#rty, #u_name_pc>;
156156

157157
#[allow(missing_docs)]
158158
#[doc(hidden)]
159-
pub struct #_name_pc;
159+
pub struct #u_name_pc;
160160
});
161161

162162
if can_read {

0 commit comments

Comments
 (0)