rustc_hir::hir

Function expr_needs_parens

Source
pub fn expr_needs_parens(expr: &Expr<'_>) -> bool
Expand description

Checks if the specified expression needs parentheses for prefix or postfix suggestions to be valid. For example, a + b requires parentheses to suggest &(a + b), but just a does not. Similarly, (a + b).c() also requires parentheses. This should not be used for other types of suggestions.