Use str::strip_prefix
@@ -16,8 +16,8 @@ impl RemoveFunctionPrefixParseCallback {
impl ParseCallbacks for RemoveFunctionPrefixParseCallback {
fn generated_name_override(&self, function_name: &str) -> Option<String> {
if let Some(prefix) = &self.remove_function_prefix {
- if function_name.starts_with(prefix) {
- return Some(function_name[prefix.len()..].to_string());
+ if let Some(name) = function_name.strip_prefix(prefix) {
+ return Some(name.to_string())
}
}
None
