From 0199e08367ab09d0e6194cd0c8f9dbfeab8b53a2 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Wed, 28 Jun 2017 10:56:29 +0900 Subject: [PATCH] Use correct one line budget in rewrite_closure_block --- src/expr.rs | 2 +- tests/source/configs-closure_block_indent_threshold--1.rs | 5 +++++ tests/target/configs-closure_block_indent_threshold--1.rs | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/source/configs-closure_block_indent_threshold--1.rs create mode 100644 tests/target/configs-closure_block_indent_threshold--1.rs diff --git a/src/expr.rs b/src/expr.rs index 35c028d24db4..471229b3f071 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -750,7 +750,7 @@ fn rewrite_closure_block( // The body of the closure is big enough to be block indented, that // means we must re-format. - let block_shape = shape.block().with_max_width(context.config); + let block_shape = shape.block(); let block_str = try_opt!(block.rewrite(&context, block_shape)); Some(format!("{} {}", prefix, block_str)) } diff --git a/tests/source/configs-closure_block_indent_threshold--1.rs b/tests/source/configs-closure_block_indent_threshold--1.rs new file mode 100644 index 000000000000..166f825b2397 --- /dev/null +++ b/tests/source/configs-closure_block_indent_threshold--1.rs @@ -0,0 +1,5 @@ +// rustfmt-closure_block_indent_threshold: -1 + +fn issue1755() { + b.iter(|| dfkljdklgjdlkfgjdlkgjldkjfgkdjgldjfgkljdfklgjlkdjfgkljdflkgjlkdfjgdjfsas::expect("parse")); +} diff --git a/tests/target/configs-closure_block_indent_threshold--1.rs b/tests/target/configs-closure_block_indent_threshold--1.rs new file mode 100644 index 000000000000..3a62e6a27edb --- /dev/null +++ b/tests/target/configs-closure_block_indent_threshold--1.rs @@ -0,0 +1,7 @@ +// rustfmt-closure_block_indent_threshold: -1 + +fn issue1755() { + b.iter(|| { + dfkljdklgjdlkfgjdlkgjldkjfgkdjgldjfgkljdfklgjlkdjfgkljdflkgjlkdfjgdjfsas::expect("parse") + }); +}