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:
@@ -1264,13 +1264,10 @@ impl<'a> State<'a> {
|
||||
_ => {}
|
||||
}
|
||||
|
||||
match *opt_trait {
|
||||
Some(ref t) => {
|
||||
try!(self.print_trait_ref(t));
|
||||
try!(space(&mut self.s));
|
||||
try!(self.word_space("for"));
|
||||
}
|
||||
None => {}
|
||||
if let Some(ref t) = *opt_trait {
|
||||
try!(self.print_trait_ref(t));
|
||||
try!(space(&mut self.s));
|
||||
try!(self.word_space("for"));
|
||||
}
|
||||
|
||||
try!(self.print_type(&ty));
|
||||
@@ -1470,11 +1467,8 @@ impl<'a> State<'a> {
|
||||
try!(self.print_tt(tt_elt));
|
||||
}
|
||||
try!(word(&mut self.s, ")"));
|
||||
match seq.separator {
|
||||
Some(ref tk) => {
|
||||
try!(word(&mut self.s, &token_to_string(tk)));
|
||||
}
|
||||
None => {},
|
||||
if let Some(ref tk) = seq.separator {
|
||||
try!(word(&mut self.s, &token_to_string(tk)));
|
||||
}
|
||||
match seq.op {
|
||||
tokenstream::KleeneOp::ZeroOrMore => word(&mut self.s, "*"),
|
||||
|
||||
Reference in New Issue
Block a user