Skip to content

Commit

Permalink
Remove MacDelimiter.
Browse files Browse the repository at this point in the history
It's the same as `Delimiter`, minus the `Invisible` variant. I'm
generally in favour of using types to make impossible states
unrepresentable, but this one feels very low-value, and the conversions
between the two types are annoying and confusing.

Look at the change in `src/tools/rustfmt/src/expr.rs` for an example:
the old code converted from `MacDelimiter` to `Delimiter` and back
again, for no good reason. This suggests the author was confused about
the types.
  • Loading branch information
nnethercote committed Aug 2, 2023
1 parent 4eeecae commit d165d4a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1382,12 +1382,8 @@ pub(crate) fn can_be_overflowed_expr(
|| (context.use_block_indent() && args_len == 1)
}
ast::ExprKind::MacCall(ref mac) => {
match (
rustc_ast::ast::MacDelimiter::from_token(mac.args.delim.to_token()),
context.config.overflow_delimited_expr(),
) {
(Some(ast::MacDelimiter::Bracket), true)
| (Some(ast::MacDelimiter::Brace), true) => true,
match (mac.args.delim, context.config.overflow_delimited_expr()) {
(Delimiter::Bracket, true) | (Delimiter::Brace, true) => true,
_ => context.use_block_indent() && args_len == 1,
}
}
Expand Down

0 comments on commit d165d4a

Please sign in to comment.