Skip to content

Commit 1f5808c

Browse files
Merge #210
210: fix: replace %S to %s in encode's change_case r=burrbull a=duskmoon314 Previous in `svd-encoder::config::change_case`, `%s` will be changed to `%S` when the case is `Constant`. This commit fix this via `replace("%S", "%s")`. Co-authored-by: Campbell He <[email protected]>
2 parents 46aaf18 + deb3fb8 commit 1f5808c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

svd-encoder/src/config.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ pub fn change_case(s: &str, case: Option<IdentifierFormat>) -> String {
5151
Boundary::Acronym,
5252
];
5353

54-
s.with_boundaries(&boundary).to_case(match case {
55-
IdentifierFormat::Camel => Case::Camel,
56-
IdentifierFormat::Pascal => Case::Pascal,
57-
IdentifierFormat::Snake => Case::Snake,
58-
IdentifierFormat::Constant => Case::UpperSnake,
59-
})
54+
s.with_boundaries(&boundary)
55+
.to_case(match case {
56+
IdentifierFormat::Camel => Case::Camel,
57+
IdentifierFormat::Pascal => Case::Pascal,
58+
IdentifierFormat::Snake => Case::Snake,
59+
IdentifierFormat::Constant => Case::UpperSnake,
60+
})
61+
.replace("%S", "%s")
6062
}
6163
}
6264
}

0 commit comments

Comments
 (0)