From 6b367a05320f2792414281075a4e98452b412a82 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 26 Apr 2022 15:21:15 +1000 Subject: Avoid producing `NoDelim` values in `MacArgs::delim()`. --- src/tools/rustfmt/src/expr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tools') diff --git a/src/tools/rustfmt/src/expr.rs b/src/tools/rustfmt/src/expr.rs index 4f333cd27ce..cd724373f4d 100644 --- a/src/tools/rustfmt/src/expr.rs +++ b/src/tools/rustfmt/src/expr.rs @@ -1325,7 +1325,7 @@ pub(crate) fn can_be_overflowed_expr( } ast::ExprKind::MacCall(ref mac) => { match ( - rustc_ast::ast::MacDelimiter::from_token(mac.args.delim()), + rustc_ast::ast::MacDelimiter::from_token(mac.args.delim().unwrap()), context.config.overflow_delimited_expr(), ) { (Some(ast::MacDelimiter::Bracket), true) -- cgit 1.4.1-3-g733a5 From 86f011704c31f4eb1e7993e1951826bca46fe8f1 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 26 Apr 2022 15:09:11 +1000 Subject: Make explicit an unreachable `NoDelim` case in `rustfmt`. --- src/tools/rustfmt/src/macros.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tools') diff --git a/src/tools/rustfmt/src/macros.rs b/src/tools/rustfmt/src/macros.rs index 664f152e8be..92606902c57 100644 --- a/src/tools/rustfmt/src/macros.rs +++ b/src/tools/rustfmt/src/macros.rs @@ -562,7 +562,7 @@ fn delim_token_to_str( ("{ ", " }") } } - DelimToken::NoDelim => ("", ""), + DelimToken::NoDelim => unreachable!(), }; if use_multiple_lines { let indent_str = shape.indent.to_string_with_newline(context.config); -- cgit 1.4.1-3-g733a5