Skip to content

Commit df74d0e

Browse files
committed
Use str::strip_prefix
1 parent a8f2634 commit df74d0e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/parse_callbacks/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ impl RemoveFunctionPrefixParseCallback {
1616
impl ParseCallbacks for RemoveFunctionPrefixParseCallback {
1717
fn generated_name_override(&self, function_name: &str) -> Option<String> {
1818
if let Some(prefix) = &self.remove_function_prefix {
19-
if function_name.starts_with(prefix) {
20-
return Some(function_name[prefix.len()..].to_string());
19+
if let Some(name) = function_name.strip_prefix(prefix) {
20+
return Some(name.to_string())
2121
}
2222
}
2323
None

0 commit comments

Comments
 (0)