From 7be202fa3c53ab1d4e208245653fde033ec0131c Mon Sep 17 00:00:00 2001 From: Mikko Rantanen Date: Thu, 13 Oct 2016 04:34:08 +0300 Subject: Add support for spaces_within_parens config (#1187) * Add support for spaces_within_parens config * Changes based on review comments --- src/patterns.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/patterns.rs') diff --git a/src/patterns.rs b/src/patterns.rs index 1aaa28b853a..149844cd196 100644 --- a/src/patterns.rs +++ b/src/patterns.rs @@ -234,10 +234,20 @@ fn rewrite_tuple_pat(pats: &[ptr::P], let list = try_opt!(format_item_list(items, width, offset, context.config)); match path_str { - Some(path_str) => Some(format!("{}({})", path_str, list)), + Some(path_str) => { + Some(if context.config.spaces_within_parens { + format!("{}( {} )", path_str, list) + } else { + format!("{}({})", path_str, list) + }) + } None => { let comma = if add_comma { "," } else { "" }; - Some(format!("({}{})", list, comma)) + Some(if context.config.spaces_within_parens { + format!("( {}{} )", list, comma) + } else { + format!("({}{})", list, comma) + }) } } } -- cgit 1.4.1-3-g733a5