Prefer .remove()
over .get()
to avoid clone
This commit is contained in:
parent
33d486ccde
commit
af443f8f57
@ -9,10 +9,10 @@ macro_rules! arg {
|
||||
};
|
||||
};
|
||||
($args:ident, $idx:literal, $name:literal=$default:expr) => {
|
||||
match $args.get(stringify!($idx)) {
|
||||
Some(v) => v.clone(),
|
||||
None => match $args.get($name) {
|
||||
Some(v) => v.clone(),
|
||||
match $args.remove(stringify!($idx)) {
|
||||
Some(v) => v.eval(),
|
||||
None => match $args.remove($name) {
|
||||
Some(v) => v.eval(),
|
||||
None => $default,
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user