Skip to content

Commit

Permalink
Replace always true conditionals with true
Browse files Browse the repository at this point in the history
  • Loading branch information
kestred committed Nov 9, 2018
1 parent 7290529 commit 9784337
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/expr.rs
Expand Up @@ -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,
}
}
Expand Down

0 comments on commit 9784337

Please sign in to comment.