Skip to content

Commit ccd3279

Browse files
committed
respace only
1 parent 91f11d1 commit ccd3279

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/generate/peripheral.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,7 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
184184
feature_attribute.extend(quote! { #[cfg(feature = #p_feature)] })
185185
};
186186
// Insert the peripheral structure
187-
per_to_tokens(
188-
&mut out,
189-
&feature_attribute,
190-
&doc,
191-
&p_ty,
192-
None,
193-
address,
194-
);
187+
per_to_tokens(&mut out, &feature_attribute, &doc, &p_ty, None, address);
195188

196189
// Derived peripherals may not require re-implementation, and will instead
197190
// use a single definition of the non-derived version.

src/util.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,13 @@ pub fn sanitize_keyword(sc: Cow<str>) -> Cow<str> {
148148
}
149149

150150
pub fn respace(s: &str) -> String {
151-
s//.split_whitespace()
152-
// .collect::<Vec<_>>()
153-
// .join(" ")
154-
.replace(r"\n", "\n")
151+
let s = if s.matches("\n").count() == 1 {
152+
// Special case for STM32
153+
s.split_whitespace().collect::<Vec<_>>().join(" ")
154+
} else {
155+
s.into()
156+
};
157+
s.replace(r"\n", "\n")
155158
}
156159

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

0 commit comments

Comments
 (0)