Don't suggest adding let in certain if conditions
This commit is contained in:
parent
b17e9d76f2
commit
2ae1ec9119
6 changed files with 142 additions and 8 deletions
|
@ -1813,6 +1813,20 @@ impl Expr<'_> {
|
|||
| ExprKind::Err => true,
|
||||
}
|
||||
}
|
||||
|
||||
// To a first-order approximation, is this a pattern
|
||||
pub fn is_approximately_pattern(&self) -> bool {
|
||||
match &self.kind {
|
||||
ExprKind::Box(_)
|
||||
| ExprKind::Array(_)
|
||||
| ExprKind::Call(..)
|
||||
| ExprKind::Tup(_)
|
||||
| ExprKind::Lit(_)
|
||||
| ExprKind::Path(_)
|
||||
| ExprKind::Struct(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks if the specified expression is a built-in range literal.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue