prefer if let
to match with None => {}
arm in some places
This is a spiritual succesor to #34268/8531d581, in which we replaced a number of matches of None to the unit value with `if let` conditionals where it was judged that this made for clearer/simpler code (as would be recommended by Manishearth/rust-clippy's `single_match` lint). The same rationale applies to matches of None to the empty block.
This commit is contained in:
parent
5e858f34df
commit
d37edef9dd
47 changed files with 213 additions and 347 deletions
|
@ -88,12 +88,9 @@ pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::Token
|
|||
}
|
||||
};
|
||||
|
||||
match exprs.next() {
|
||||
None => {}
|
||||
Some(_) => {
|
||||
cx.span_err(sp, "env! takes 1 or 2 arguments");
|
||||
return DummyResult::expr(sp);
|
||||
}
|
||||
if let Some(_) = exprs.next() {
|
||||
cx.span_err(sp, "env! takes 1 or 2 arguments");
|
||||
return DummyResult::expr(sp);
|
||||
}
|
||||
|
||||
let e = match env::var(&var[..]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue