about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-08-02 09:56:26 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2023-08-03 09:03:30 +1000
commitd75ee2a6bcfc2ec9b21c0bb1ffaf34ff6b7161f1 (patch)
treed9c3e155ef8f3751de71e8d3578b3f0caea6ab2c /src
parentba294a816bd51526b8bf99cb21050f669b8397b0 (diff)
downloadrust-d75ee2a6bcfc2ec9b21c0bb1ffaf34ff6b7161f1.tar.gz
rust-d75ee2a6bcfc2ec9b21c0bb1ffaf34ff6b7161f1.zip
Remove `MacDelimiter`.
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.
Diffstat (limited to 'src')
-rw-r--r--src/tools/rustfmt/src/expr.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/tools/rustfmt/src/expr.rs b/src/tools/rustfmt/src/expr.rs
index 5b1b4fbd491..739afb4e0ac 100644
--- a/src/tools/rustfmt/src/expr.rs
+++ b/src/tools/rustfmt/src/expr.rs
@@ -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,
             }
         }