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) => {
|
($args:ident, $idx:literal, $name:literal=$default:expr) => {
|
||||||
match $args.get(stringify!($idx)) {
|
match $args.remove(stringify!($idx)) {
|
||||||
Some(v) => v.clone(),
|
Some(v) => v.eval(),
|
||||||
None => match $args.get($name) {
|
None => match $args.remove($name) {
|
||||||
Some(v) => v.clone(),
|
Some(v) => v.eval(),
|
||||||
None => $default,
|
None => $default,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user