mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-31 07:37:30 +00:00
Implement if_to_bool_then assist
This commit is contained in:
parent
f0d32591a6
commit
3b7c713af3
5 changed files with 386 additions and 5 deletions
|
@ -56,6 +56,10 @@ impl ast::BlockExpr {
|
|||
pub fn is_empty(&self) -> bool {
|
||||
self.statements().next().is_none() && self.tail_expr().is_none()
|
||||
}
|
||||
|
||||
pub fn as_lone_tail(&self) -> Option<ast::Expr> {
|
||||
self.statements().next().is_none().then(|| self.tail_expr()).flatten()
|
||||
}
|
||||
}
|
||||
|
||||
impl ast::Pat {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue