+fn handle_vec_semi(
+ context: &RewriteContext<'_>,
+ shape: Shape,
+ arg_vec: Vec<MacroArg>,
+ macro_name: String,
+ delim_token: DelimToken,
+) -> Option<String> {
+ let (left, right) = match delim_token {
+ DelimToken::Paren => ("(", ")"),
+ DelimToken::Bracket => ("[", "]"),
+ _ => unreachable!(),
+ };
+
+ let mac_shape = shape.offset_left(macro_name.len())?;
+ // 8 = `vec![]` + `; ` or `vec!()` + `; `
+ let total_overhead = 8;
+ let nested_shape = mac_shape.block_indent(context.config.tab_spaces());
+ let lhs = arg_vec[0].rewrite(context, nested_shape)?;
+ let rhs = arg_vec[1].rewrite(context, nested_shape)?;
+ if !lhs.contains('\n')
+ && !rhs.contains('\n')
+ && lhs.len() + rhs.len() + total_overhead <= shape.width
+ {
+ // macro_name(lhs; rhs) or macro_name[lhs; rhs]
+ Some(format!("{}{}{}; {}{}", macro_name, left, lhs, rhs, right))
+ } else {
+ // macro_name(\nlhs;\nrhs\n) or macro_name[\nlhs;\nrhs\n]
+ Some(format!(
+ "{}{}{}{};{}{}{}{}",
+ macro_name,
+ left,
+ nested_shape.indent.to_string_with_newline(context.config),
+ lhs,
+ nested_shape.indent.to_string_with_newline(context.config),
+ rhs,
+ shape.indent.to_string_with_newline(context.config),
+ right
+ ))
+ }
+}
+
+pub(crate) fn rewrite_macro_def(
+ context: &RewriteContext<'_>,