Skip to content

Commit 5e95130

Browse files
authored
please clippy (#2570)
1 parent 441bc7b commit 5e95130

File tree

1 file changed

+3
-11
lines changed
  • bindgen-tests/tests/parse_callbacks

1 file changed

+3
-11
lines changed

bindgen-tests/tests/parse_callbacks/mod.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,6 @@ impl ParseCallbacks for WrapAsVariadicFn {
123123
}
124124

125125
pub fn lookup(cb: &str) -> Box<dyn ParseCallbacks> {
126-
fn try_strip_prefix<'a>(s: &'a str, prefix: &str) -> Option<&'a str> {
127-
if s.starts_with(prefix) {
128-
Some(&s[prefix.len()..])
129-
} else {
130-
None
131-
}
132-
}
133-
134126
match cb {
135127
"enum-variant-rename" => Box::new(EnumVariantRename),
136128
"blocklisted-type-implements-trait" => {
@@ -139,17 +131,17 @@ pub fn lookup(cb: &str) -> Box<dyn ParseCallbacks> {
139131
"wrap-as-variadic-fn" => Box::new(WrapAsVariadicFn),
140132
call_back => {
141133
if let Some(prefix) =
142-
try_strip_prefix(call_back, "remove-function-prefix-")
134+
call_back.strip_prefix("remove-function-prefix-")
143135
{
144136
let lnopc = RemovePrefixParseCallback::new(prefix);
145137
Box::new(lnopc)
146138
} else if let Some(prefix) =
147-
try_strip_prefix(call_back, "prefix-link-name-")
139+
call_back.strip_prefix("prefix-link-name-")
148140
{
149141
let plnpc = PrefixLinkNameParseCallback::new(prefix);
150142
Box::new(plnpc)
151143
} else if let Some(default) =
152-
try_strip_prefix(call_back, "field-visibility-default-")
144+
call_back.strip_prefix("field-visibility-default-")
153145
{
154146
Box::new(FieldVisibility {
155147
default: default.parse().expect(

0 commit comments

Comments
 (0)