Skip to content

Commit e0860b7

Browse files
bors[bot]rcls
andauthored
Merge #532
532: Remove unnecessary borrows. r=burrbull a=rcls Running `cargo +nightly clippy`, I noticed a few complaints about unnecessary borrows. Remove those. Clippy now has no complaints either on stable or nightly. Still builds with stable, and running on a few SVD files, no changes (except for version info). Co-authored-by: Ralph Loader <[email protected]>
2 parents 1969890 + 3e68578 commit e0860b7

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/generate/peripheral.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ fn expand_cluster(
696696

697697
if array_convertible {
698698
cluster_expanded.push(RegisterBlockField {
699-
field: convert_svd_cluster(&cluster, name)?,
699+
field: convert_svd_cluster(cluster, name)?,
700700
description: info.description.as_ref().unwrap_or(&info.name).into(),
701701
offset: info.address_offset,
702702
size: cluster_size * array_info.dim,
@@ -754,7 +754,7 @@ fn expand_register(
754754

755755
if array_convertible {
756756
register_expanded.push(RegisterBlockField {
757-
field: convert_svd_register(&register, name, config.ignore_groups)?,
757+
field: convert_svd_register(register, name, config.ignore_groups)?,
758758
description: info.description.clone().unwrap_or_default(),
759759
offset: info.address_offset,
760760
size: register_size * array_info.dim,
@@ -987,7 +987,7 @@ fn name_to_ty_str<'a, 'b>(name: &'a str, ns: Option<&'b str>) -> Cow<'a, str> {
987987
}
988988

989989
fn name_to_ty(name: &str, ns: Option<&str>) -> Result<syn::Type, syn::Error> {
990-
let ident = name_to_ty_str(&name, ns);
990+
let ident = name_to_ty_str(name, ns);
991991
Ok(syn::Type::Path(parse_str::<syn::TypePath>(&ident)?))
992992
}
993993

src/generate/register.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,12 @@ pub fn fields(
404404
}
405405
};
406406
let name_sc_n = Ident::new(
407-
&util::replace_suffix(&f.name.to_sanitized_snake_case(), &suffix),
407+
&util::replace_suffix(&f.name.to_sanitized_snake_case(), suffix),
408408
Span::call_site(),
409409
);
410410
let doc = util::replace_suffix(
411411
&description_with_bits(&description, sub_offset, width),
412-
&suffix,
412+
suffix,
413413
);
414414
r_impl_items.extend(quote! {
415415
#[doc = #doc]
@@ -587,7 +587,7 @@ pub fn fields(
587587
let pc = util::replace_suffix(base.field, "");
588588
let pc = pc.to_sanitized_upper_case();
589589
let base_pc_w = Ident::new(&(pc + "_AW"), span);
590-
derive_from_base(mod_items, &base, &name_pc_aw, &base_pc_w, &description)
590+
derive_from_base(mod_items, &base, name_pc_aw, &base_pc_w, &description)
591591
} else if variants.is_empty() {
592592
add_with_no_variants(mod_items, name_pc_aw, &fty, &description, rv);
593593
} else {
@@ -761,12 +761,12 @@ pub fn fields(
761761
for (i, suffix) in (0..*dim).zip(suffixes.iter()) {
762762
let sub_offset = offset + (i as u64) * (*increment as u64);
763763
let name_sc_n = Ident::new(
764-
&util::replace_suffix(&f.name.to_sanitized_snake_case(), &suffix),
764+
&util::replace_suffix(&f.name.to_sanitized_snake_case(), suffix),
765765
Span::call_site(),
766766
);
767767
let doc = util::replace_suffix(
768768
&description_with_bits(&description, sub_offset, width),
769-
&suffix,
769+
suffix,
770770
);
771771
let sub_offset = util::unsuffixed(sub_offset as u64);
772772
if !config.const_generic {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ pub fn generate(xml: &str, config: &Config) -> Result<Generation> {
535535
let device = svd::parse(xml)?;
536536
let mut device_x = String::new();
537537
let items =
538-
generate::device::render(&device, &config, &mut device_x).or(Err(SvdError::Render))?;
538+
generate::device::render(&device, config, &mut device_x).or(Err(SvdError::Render))?;
539539

540540
let mut lib_rs = String::new();
541541
writeln!(

0 commit comments

Comments
 (0)