mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-08 13:55:25 +00:00
Replace always true conditionals with true
This commit is contained in:
parent
7290529b3f
commit
97843377ee
18
src/expr.rs
18
src/expr.rs
@ -1340,24 +1340,18 @@ pub fn can_be_overflowed_expr(context: &RewriteContext, expr: &ast::Expr, args_l
|
||||
| ast::ExprKind::WhileLet(..) => {
|
||||
context.config.combine_control_expr() && context.use_block_indent() && args_len == 1
|
||||
}
|
||||
ast::ExprKind::Block(..) | ast::ExprKind::Closure(..) => {
|
||||
context.use_block_indent() || context.config.indent_style() == IndentStyle::Visual
|
||||
}
|
||||
|
||||
// Handle always block-like expressions
|
||||
ast::ExprKind::Block(..) | ast::ExprKind::Closure(..) => true,
|
||||
|
||||
// Handle `[]` and `{}`-like expressions
|
||||
ast::ExprKind::Array(..) | ast::ExprKind::Struct(..) => {
|
||||
if context.config.overflow_delimited_expr() {
|
||||
context.use_block_indent() || context.config.indent_style() == IndentStyle::Visual
|
||||
} else {
|
||||
context.use_block_indent() && args_len == 1
|
||||
}
|
||||
context.config.overflow_delimited_expr()
|
||||
|| (context.use_block_indent() && args_len == 1)
|
||||
}
|
||||
ast::ExprKind::Mac(ref macro_) => {
|
||||
match (macro_.node.delim, context.config.overflow_delimited_expr()) {
|
||||
(ast::MacDelimiter::Bracket, true) | (ast::MacDelimiter::Brace, true) => {
|
||||
context.use_block_indent()
|
||||
|| context.config.indent_style() == IndentStyle::Visual
|
||||
}
|
||||
(ast::MacDelimiter::Bracket, true) | (ast::MacDelimiter::Brace, true) => true,
|
||||
_ => context.use_block_indent() && args_len == 1,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user