Skip to content

Commit

Permalink
derive-backend: fix clippy warning for strip_prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Nov 19, 2020
1 parent dcca3f8 commit 5ac213f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pyo3-derive-backend/src/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,10 @@ impl<'a> FnSpec<'a> {

// strip get_ or set_
let strip_fn_name = |prefix: &'static str| {
let ident = sig.ident.unraw().to_string();
if ident.starts_with(prefix) {
Some(syn::Ident::new(&ident[prefix.len()..], ident.span()))
} else {
None
}
name.unraw()
.to_string()
.strip_prefix(prefix)
.map(|rest| syn::Ident::new(rest, name.span()))
};

// Parse receiver & function type for various method types
Expand Down

0 comments on commit 5ac213f

Please sign in to comment.