Skip to content

Commit

Permalink
respace only
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Oct 25, 2024
1 parent 91f11d1 commit ccd3279
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
9 changes: 1 addition & 8 deletions src/generate/peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,7 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
feature_attribute.extend(quote! { #[cfg(feature = #p_feature)] })
};
// Insert the peripheral structure
per_to_tokens(
&mut out,
&feature_attribute,
&doc,
&p_ty,
None,
address,
);
per_to_tokens(&mut out, &feature_attribute, &doc, &p_ty, None, address);

// Derived peripherals may not require re-implementation, and will instead
// use a single definition of the non-derived version.
Expand Down
11 changes: 7 additions & 4 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,13 @@ pub fn sanitize_keyword(sc: Cow<str>) -> Cow<str> {
}

pub fn respace(s: &str) -> String {
s//.split_whitespace()
// .collect::<Vec<_>>()
// .join(" ")
.replace(r"\n", "\n")
let s = if s.matches("\n").count() == 1 {
// Special case for STM32
s.split_whitespace().collect::<Vec<_>>().join(" ")
} else {
s.into()
};
s.replace(r"\n", "\n")
}

pub fn escape_brackets(s: &str) -> String {
Expand Down

0 comments on commit ccd3279

Please sign in to comment.