Do only use ConstructorToken when needed

Also removing some effectively dead code
This commit is contained in:
konstin
2018-04-15 01:29:09 +02:00
parent d87e07f45e
commit f45ce1f239
3 changed files with 51 additions and 45 deletions

View File

@ -203,7 +203,7 @@ impl Program {
panic!("can only bindgen safe functions");
}
let mut opts = BindgenAttrs::find(&mut method.attrs);
let opts = BindgenAttrs::find(&mut method.attrs);
let is_constructor = opts.constructor();
let constructor = if is_constructor {
Some(method.sig.ident.to_string())
@ -211,16 +211,6 @@ impl Program {
None
};
if is_constructor {
let pos = opts.attrs
.iter()
.enumerate()
.find(|(_, a)| **a == BindgenAttr::Constructor)
.unwrap()
.0;
opts.attrs.remove(pos);
}
let (function, mutable) = Function::from_decl(
method.sig.ident,
Box::new(method.sig.decl.clone()),