Skip to content

Commit c13b87d

Browse files
committed
strings
1 parent dbd8734 commit c13b87d

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/generate/interrupt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ pub fn render(
6262
interrupt
6363
.0
6464
.description
65-
.as_ref()
66-
.map(|s| util::respace(s))
67-
.as_ref()
68-
.map(|s| util::escape_special_chars(s))
65+
.as_deref()
66+
.map(util::respace)
67+
.as_deref()
68+
.map(util::escape_special_chars)
6969
.unwrap_or_else(|| interrupt.0.name.clone())
7070
);
7171

src/generate/peripheral.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl Region {
305305
let mut idents: Vec<_> = self
306306
.rbfs
307307
.iter()
308-
.filter_map(|f| f.syn_field.ident.as_ref().map(|ident| ident.to_string()))
308+
.filter_map(|f| f.syn_field.ident.as_ref().map(ToString::to_string))
309309
.collect();
310310
if idents.is_empty() {
311311
return None;
@@ -343,7 +343,7 @@ impl Region {
343343
let idents: Vec<_> = self
344344
.rbfs
345345
.iter()
346-
.filter_map(|f| f.syn_field.ident.as_ref().map(|ident| ident.to_string()))
346+
.filter_map(|f| f.syn_field.ident.as_ref().map(ToString::to_string))
347347
.collect();
348348

349349
if idents.is_empty() {
@@ -726,7 +726,7 @@ fn check_erc_derive_infos(
726726
};
727727
match register {
728728
Register::Single(_) => {
729-
let ty_name = info_name.to_string();
729+
let ty_name = info_name.clone();
730730
*derive_info = match explicit_rpath {
731731
None => {
732732
match compare_this_against_prev(
@@ -758,7 +758,7 @@ fn check_erc_derive_infos(
758758
let re = Regex::new(format!("^{re_string}$").as_str()).map_err(|_| {
759759
anyhow!("Error creating regex for register {}", register.name)
760760
})?;
761-
let ty_name = info_name.to_string(); // keep suffix for regex matching
761+
let ty_name = info_name.clone(); // keep suffix for regex matching
762762
*derive_info = match explicit_rpath {
763763
None => {
764764
match compare_this_against_prev(
@@ -787,7 +787,7 @@ fn check_erc_derive_infos(
787787
}
788788
RegisterCluster::Cluster(cluster) => {
789789
*derive_info = DeriveInfo::Cluster;
790-
ercs_type_info.push((cluster.name.to_string(), None, erc, derive_info));
790+
ercs_type_info.push((cluster.name.clone(), None, erc, derive_info));
791791
}
792792
};
793793
}

src/generate/register.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ fn api_docs(
222222
let idx = format!("[{idx}]");
223223
rpath.name.replace("[%s]", &idx).replace("%s", &idx)
224224
} else {
225-
rpath.name.to_string()
225+
rpath.name.clone()
226226
};
227227
// TODO: support html_urls for registers in cluster
228228
if rpath.block.path.is_empty() {

0 commit comments

Comments
 (0)