From 10f1257eb34d978ad230de503dc1df7a5d520d95 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Sun, 13 Aug 2017 10:17:52 +0900 Subject: [PATCH] Use correct width for subexpr_list --- src/chains.rs | 1 + tests/source/expr-block.rs | 4 ++++ tests/target/expr-block.rs | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/src/chains.rs b/src/chains.rs index 75dac5b3227..9c129ef99ee 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -233,6 +233,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) - connector.as_str() }; + let subexpr_num = subexpr_list.len(); let result = if is_small_parent && rewrites.len() > 1 { let second_connector = choose_first_connector( context, diff --git a/tests/source/expr-block.rs b/tests/source/expr-block.rs index 3b4e6356ff9..1d55bd0a0d9 100644 --- a/tests/source/expr-block.rs +++ b/tests/source/expr-block.rs @@ -282,3 +282,7 @@ fn issue_1862() { /* com */ this_last_arg_is_tooooooooooooooooooooooooooooooooo_long_to_be_kept_with_the_pre_comment , ) } + +fn issue_1878() { + let channel: &str = seq.next_element()?.ok_or_else(|| de::Error::invalid_length(2, &self))?; +} diff --git a/tests/target/expr-block.rs b/tests/target/expr-block.rs index 68c5421c3ca..194798ff472 100644 --- a/tests/target/expr-block.rs +++ b/tests/target/expr-block.rs @@ -333,3 +333,8 @@ fn issue_1862() { this_last_arg_is_tooooooooooooooooooooooooooooooooo_long_to_be_kept_with_the_pre_comment, ) } + +fn issue_1878() { + let channel: &str = seq.next_element()? + .ok_or_else(|| de::Error::invalid_length(2, &self))?; +}