From 154ccf6a02e3842e064ebc17b47a6abaf00e0691 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Thu, 31 Jan 2019 23:44:58 +0900 Subject: [PATCH] Do not force trailing comma when using mixed layout --- Cargo.lock | 2 ++ src/overflow.rs | 3 --- tests/source/trailing-comma-never.rs | 4 ++++ tests/target/trailing-comma-never.rs | 4 ++++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 01cb370a89a..bc52c406226 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "aho-corasick" version = "0.6.9" diff --git a/src/overflow.rs b/src/overflow.rs index 344fb28620b..98702e82fda 100644 --- a/src/overflow.rs +++ b/src/overflow.rs @@ -607,9 +607,6 @@ impl<'a> Context<'a> { tactic } else if !self.context.use_block_indent() { SeparatorTactic::Never - } else if tactic == DefinitiveListTactic::Mixed { - // We are using mixed layout because everything did not fit within a single line. - SeparatorTactic::Always } else { self.context.config.trailing_comma() }; diff --git a/tests/source/trailing-comma-never.rs b/tests/source/trailing-comma-never.rs index 5985b514724..c74267cd179 100644 --- a/tests/source/trailing-comma-never.rs +++ b/tests/source/trailing-comma-never.rs @@ -39,3 +39,7 @@ enum StructY { i: i32, } } + +static XXX: [i8; 64] = [ +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1, 1, 1, +]; diff --git a/tests/target/trailing-comma-never.rs b/tests/target/trailing-comma-never.rs index 3df0c7950eb..ea199f5ff29 100644 --- a/tests/target/trailing-comma-never.rs +++ b/tests/target/trailing-comma-never.rs @@ -29,3 +29,7 @@ enum StructY { A { s: u16 }, B { u: u32, i: i32 } } + +static XXX: [i8; 64] = [ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 +];