Minor code cleanup.

This commit is contained in:
Stephen Chung
2020-03-14 23:41:21 +08:00
parent 01cf777961
commit f80e499e84
2 changed files with 11 additions and 11 deletions

View File

@@ -196,13 +196,10 @@ macro_rules! def_register {
// Call the user-supplied function using ($clone) to
// potentially clone the value, otherwise pass the reference.
match f($(($clone)($par)),*) {
Ok(r) => Ok(Box::new(r) as Dynamic),
Err(mut err) => {
err.set_position(pos);
Err(err)
}
}
f($(($clone)($par)),*).map(|r| Box::new(r) as Dynamic).map_err(|mut err| {
err.set_position(pos);
err
})
};
self.register_fn_raw(name, Some(vec![$(TypeId::of::<$par>()),*]), Box::new(fun));
}