Prefer match
over if let
This commit is contained in:
parent
33244c34d7
commit
6efb4141f6
@ -137,27 +137,22 @@ pub fn eat_call_args<I: Iterator<Item = Token>>(toks: &mut Peekable<I>) -> CallA
|
|||||||
args.insert(name.clone().unwrap(), val.clone());
|
args.insert(name.clone().unwrap(), val.clone());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => val.push(toks.next().expect("we know this exists!")),
|
||||||
let tok = toks.next().expect("we know this exists!");
|
|
||||||
val.push(tok)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TokenKind::Symbol(Symbol::CloseParen) => {
|
TokenKind::Symbol(Symbol::CloseParen) => {
|
||||||
if let Some(name) = name {
|
match name {
|
||||||
args.insert(name, val);
|
Some(name) => args.insert(name, val),
|
||||||
} else {
|
None => args.insert(format!("{}", args.len()), val),
|
||||||
args.insert(format!("{}", args.len()), val);
|
};
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TokenKind::Symbol(Symbol::Comma) => {
|
TokenKind::Symbol(Symbol::Comma) => {
|
||||||
if let Some(ref name) = name {
|
match name {
|
||||||
args.insert(name.clone(), val.clone());
|
Some(ref name) => args.insert(name.clone(), val.clone()),
|
||||||
} else {
|
None => args.insert(format!("{}", args.len()), val.clone()),
|
||||||
args.insert(format!("{}", args.len()), val.clone());
|
};
|
||||||
}
|
|
||||||
if let Some(ref mut s) = name {
|
if let Some(ref mut s) = name {
|
||||||
s.clear();
|
s.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user