Skip to content

Commit 6610c64

Browse files
committed
2 parents 51dc04b + 36c3ec3 commit 6610c64

File tree

5 files changed

+90
-90
lines changed

5 files changed

+90
-90
lines changed

src/generate/device.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub fn render(
9090
let bits = util::unsuffixed(u64::from(cpu.nvic_priority_bits));
9191

9292
out.push(quote! {
93-
/// Number available in the NVIC for configuring priority
93+
///Number available in the NVIC for configuring priority
9494
pub const NVIC_PRIO_BITS: u8 = #bits;
9595
});
9696

@@ -157,7 +157,7 @@ pub fn render(
157157
}
158158

159159
let p = p.name.to_sanitized_upper_case();
160-
let id = Ident::new(&*p);
160+
let id = Ident::from(&*p);
161161
fields.push(quote! {
162162
#[doc = #p]
163163
pub #id: #id
@@ -166,14 +166,14 @@ pub fn render(
166166
}
167167

168168
let take = match target {
169-
Target::CortexM => Some(Ident::new("cortex_m")),
170-
Target::Msp430 => Some(Ident::new("msp430")),
171-
Target::RISCV => Some(Ident::new("riscv")),
169+
Target::CortexM => Some(Ident::from("cortex_m")),
170+
Target::Msp430 => Some(Ident::from("msp430")),
171+
Target::RISCV => Some(Ident::from("riscv")),
172172
Target::None => None,
173173
}
174174
.map(|krate| {
175175
quote! {
176-
/// Returns all the peripherals *once*
176+
///Returns all the peripherals *once*
177177
#[inline]
178178
pub fn take() -> Option<Self> {
179179
#krate::interrupt::free(|_| {
@@ -194,7 +194,7 @@ pub fn render(
194194
#[no_mangle]
195195
static mut DEVICE_PERIPHERALS: bool = false;
196196

197-
/// All the peripherals
197+
///All the peripherals
198198
#[allow(non_snake_case)]
199199
pub struct Peripherals {
200200
#(#fields,)*
@@ -203,7 +203,7 @@ pub fn render(
203203
impl Peripherals {
204204
#take
205205

206-
/// Unchecked version of `Peripherals::take`
206+
///Unchecked version of `Peripherals::take`
207207
pub unsafe fn steal() -> Self {
208208
DEVICE_PERIPHERALS = true;
209209

src/generate/interrupt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn render(
4242
}
4343
pos += 1;
4444

45-
let name_uc = Ident::new(interrupt.name.to_sanitized_upper_case());
45+
let name_uc = Ident::from(interrupt.name.to_sanitized_upper_case());
4646
let description = format!(
4747
"{} - {}",
4848
interrupt.value,
@@ -153,7 +153,7 @@ pub fn render(
153153
}
154154

155155
let interrupt_enum = quote! {
156-
/// Enumeration of all the interrupts
156+
///Enumeration of all the interrupts
157157
#[derive(Copy, Clone, Debug)]
158158
pub enum Interrupt {
159159
#(#variants)*

src/generate/peripheral.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ pub fn render(
3333
return Ok(out);
3434
}
3535

36-
let name_pc = Ident::new(&*p.name.to_sanitized_upper_case());
36+
let name_pc = Ident::from(&*p.name.to_sanitized_upper_case());
3737
let address = util::hex(p.base_address);
3838
let description = util::respace(p.description.as_ref().unwrap_or(&p.name));
3939
let derive_regs = p_derivedfrom.is_some() && p_original.registers.is_none();
4040

41-
let name_sc = Ident::new(&*p.name.to_sanitized_snake_case());
41+
let name_sc = Ident::from(&*p.name.to_sanitized_snake_case());
4242
let base = if derive_regs {
43-
Ident::new(&*p_derivedfrom.unwrap().name.to_sanitized_snake_case())
43+
Ident::from(&*p_derivedfrom.unwrap().name.to_sanitized_snake_case())
4444
} else {
4545
name_sc.clone()
4646
};
@@ -53,7 +53,7 @@ pub fn render(
5353
unsafe impl Send for #name_pc {}
5454

5555
impl #name_pc {
56-
/// Returns a pointer to the register block
56+
///Returns a pointer to the register block
5757
#[inline(always)]
5858
pub const fn ptr() -> *const #base::RegisterBlock {
5959
#address as *const _
@@ -63,7 +63,7 @@ pub fn render(
6363
impl Deref for #name_pc {
6464
type Target = #base::RegisterBlock;
6565

66-
fn deref(&self) -> &#base::RegisterBlock {
66+
fn deref(&self) -> &Self::Target {
6767
unsafe { &*#name_pc::ptr() }
6868
}
6969
}
@@ -450,7 +450,7 @@ fn register_or_cluster_block(
450450
// Check if we need padding
451451
let pad = region.offset - last_end;
452452
if pad != 0 {
453-
let name = Ident::new(format!("_reserved{}", i));
453+
let name = Ident::from(format!("_reserved{}", i));
454454
let pad = pad as usize;
455455
fields.append(quote! {
456456
#name : [u8; #pad],
@@ -469,7 +469,7 @@ fn register_or_cluster_block(
469469

470470
if is_region_a_union {
471471
let name = &reg_block_field.field.ident;
472-
let mut_name = Ident::new(format!("{}_mut", name.as_ref().unwrap()));
472+
let mut_name = Ident::from(format!("{}_mut", name.as_ref().unwrap()));
473473
let ty = &reg_block_field.field.ty;
474474
let offset = reg_block_field.offset as usize;
475475
have_accessors = true;
@@ -496,7 +496,7 @@ fn register_or_cluster_block(
496496
});
497497

498498
reg_block_field.field.to_tokens(&mut region_fields);
499-
Ident::new(",").to_tokens(&mut region_fields);
499+
Ident::from(",").to_tokens(&mut region_fields);
500500
}
501501
}
502502

@@ -515,7 +515,7 @@ fn register_or_cluster_block(
515515
// name, along with the region number, falling back to
516516
// the offset and end in case we couldn't figure out a
517517
// nice identifier.
518-
let name = Ident::new(format!("_reserved_{}_{}", i, region.compute_ident().unwrap_or_else(|| format!("{}_{}", region.offset, region.end))));
518+
let name = Ident::from(format!("_reserved_{}_{}", i, region.compute_ident().unwrap_or_else(|| format!("{}_{}", region.offset, region.end))));
519519
let pad = (region.end - region.offset) as usize;
520520
fields.append(quote! {
521521
#name: [u8; #pad],
@@ -524,7 +524,7 @@ fn register_or_cluster_block(
524524
last_end = region.end;
525525
}
526526

527-
let name = Ident::new(match name {
527+
let name = Ident::from(match name {
528528
Some(name) => name.to_sanitized_upper_case(),
529529
None => "RegisterBlock".into(),
530530
});
@@ -540,7 +540,7 @@ fn register_or_cluster_block(
540540
};
541541

542542
Ok(quote! {
543-
/// Register block
543+
///Register block
544544
#[repr(C)]
545545
pub struct #name {
546546
#fields
@@ -723,7 +723,7 @@ fn cluster_block(
723723
}
724724
.replace("[%s]", "")
725725
.replace("%s", "");
726-
let name_sc = Ident::new(&*mod_name.to_sanitized_snake_case());
726+
let name_sc = Ident::from(&*mod_name.to_sanitized_snake_case());
727727
let reg_block = register_or_cluster_block(&c.children, defaults, Some(&mod_name), nightly)?;
728728

729729
// Generate definition for each of the registers.
@@ -747,7 +747,7 @@ fn cluster_block(
747747
Ok(quote! {
748748
#reg_block
749749

750-
/// Register block
750+
///Register block
751751
#[doc = #description]
752752
pub mod #name_sc {
753753
#(#mod_items)*
@@ -775,7 +775,7 @@ fn expand_svd_register(register: &Register, name: Option<&str>) -> Vec<syn::Fiel
775775
syn::Path {
776776
global: false,
777777
segments: vec![syn::PathSegment {
778-
ident: Ident::new(ident),
778+
ident: Ident::from(ident),
779779
parameters: syn::PathParameters::none(),
780780
}],
781781
},
@@ -814,7 +814,7 @@ fn expand_svd_register(register: &Register, name: Option<&str>) -> Vec<syn::Fiel
814814
info.name.replace("%s", "")
815815
};
816816

817-
let ident = Ident::new(nb_name.to_sanitized_snake_case());
817+
let ident = Ident::from(nb_name.to_sanitized_snake_case());
818818
let ty = name_to_ty(&ty_name, name);
819819

820820
out.push(syn::Field {
@@ -848,7 +848,7 @@ fn convert_svd_register(register: &Register, name: Option<&str>) -> syn::Field {
848848
syn::Path {
849849
global: false,
850850
segments: vec![syn::PathSegment {
851-
ident: Ident::new(ident),
851+
ident: Ident::from(ident),
852852
parameters: syn::PathParameters::none(),
853853
}],
854854
},
@@ -857,7 +857,7 @@ fn convert_svd_register(register: &Register, name: Option<&str>) -> syn::Field {
857857

858858
match register {
859859
Register::Single(info) => syn::Field {
860-
ident: Some(Ident::new(info.name.to_sanitized_snake_case())),
860+
ident: Some(Ident::from(info.name.to_sanitized_snake_case())),
861861
vis: syn::Visibility::Public,
862862
attrs: vec![],
863863
ty: name_to_ty(&info.name, name),
@@ -871,7 +871,7 @@ fn convert_svd_register(register: &Register, name: Option<&str>) -> syn::Field {
871871
info.name.replace("%s", "")
872872
};
873873

874-
let ident = Ident::new(nb_name.to_sanitized_snake_case());
874+
let ident = Ident::from(nb_name.to_sanitized_snake_case());
875875

876876
let ty = syn::Ty::Array(
877877
Box::new(name_to_ty(&nb_name, name)),
@@ -900,7 +900,7 @@ fn expand_svd_cluster(cluster: &Cluster) -> Vec<syn::Field> {
900900
syn::Path {
901901
global: false,
902902
segments: vec![syn::PathSegment {
903-
ident: Ident::new(name.to_sanitized_upper_case()),
903+
ident: Ident::from(name.to_sanitized_upper_case()),
904904
parameters: syn::PathParameters::none(),
905905
}],
906906
},
@@ -939,7 +939,7 @@ fn expand_svd_cluster(cluster: &Cluster) -> Vec<syn::Field> {
939939
info.name.replace("%s", "")
940940
};
941941

942-
let ident = Ident::new(name.to_sanitized_snake_case());
942+
let ident = Ident::from(name.to_sanitized_snake_case());
943943
let ty = name_to_ty(&ty_name);
944944

945945
out.push(syn::Field {
@@ -962,7 +962,7 @@ fn convert_svd_cluster(cluster: &Cluster) -> syn::Field {
962962
syn::Path {
963963
global: false,
964964
segments: vec![syn::PathSegment {
965-
ident: Ident::new(name.to_sanitized_upper_case()),
965+
ident: Ident::from(name.to_sanitized_upper_case()),
966966
parameters: syn::PathParameters::none(),
967967
}],
968968
},
@@ -971,7 +971,7 @@ fn convert_svd_cluster(cluster: &Cluster) -> syn::Field {
971971

972972
match cluster {
973973
Cluster::Single(info) => syn::Field {
974-
ident: Some(Ident::new(info.name.to_sanitized_snake_case())),
974+
ident: Some(Ident::from(info.name.to_sanitized_snake_case())),
975975
vis: syn::Visibility::Public,
976976
attrs: vec![],
977977
ty: name_to_ty(&info.name),
@@ -985,7 +985,7 @@ fn convert_svd_cluster(cluster: &Cluster) -> syn::Field {
985985
info.name.replace("%s", "")
986986
};
987987

988-
let ident = Ident::new(name.to_sanitized_snake_case());
988+
let ident = Ident::from(name.to_sanitized_snake_case());
989989

990990
let ty = syn::Ty::Array(
991991
Box::new(name_to_ty(&name)),

0 commit comments

Comments
 (0)