Replace if let Some(_) = foo with if foo.is_some()

This commit is contained in:
Aramis Razzaghipour 2021-10-03 23:51:30 +11:00
parent eff195852d
commit f29796da61
No known key found for this signature in database
GPG key ID: F788F7E990136003
6 changed files with 7 additions and 7 deletions

View file

@ -455,7 +455,7 @@ impl ast::RecordExprField {
/// This will either replace the initializer, or in the case that this is a shorthand convert
/// the initializer into the name ref and insert the expr as the new initializer.
pub fn replace_expr(&self, expr: ast::Expr) {
if let Some(_) = self.name_ref() {
if self.name_ref().is_some() {
match self.expr() {
Some(prev) => ted::replace(prev.syntax(), expr.syntax()),
None => ted::append_child(self.syntax(), expr.syntax()),