From ef84319e47dfe899b7fe530248c15c1392ced8a3 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Sun, 27 Aug 2017 14:57:21 +0900 Subject: [PATCH] Fix a typo in calculating overhead for fn args --- src/items.rs | 3 +-- tests/source/configs-fn_args_layout-visual.rs | 22 +++++++++++++++++ tests/target/configs-fn_args_layout-visual.rs | 24 +++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/items.rs b/src/items.rs index 9dd1972670a..b1636ef0123 100644 --- a/src/items.rs +++ b/src/items.rs @@ -2284,8 +2284,7 @@ fn compute_budgets_for_args( } IndentStyle::Visual => { let indent = indent + result.len() + 1; - let multi_line_overhead = - indent.width() + result.len() + if newline_brace { 2 } else { 4 }; + let multi_line_overhead = indent.width() + if newline_brace { 2 } else { 4 }; let budget = try_opt!(context.config.max_width().checked_sub(multi_line_overhead)); (indent, budget) diff --git a/tests/source/configs-fn_args_layout-visual.rs b/tests/source/configs-fn_args_layout-visual.rs index b0d88fb0651..e0af153f982 100644 --- a/tests/source/configs-fn_args_layout-visual.rs +++ b/tests/source/configs-fn_args_layout-visual.rs @@ -8,3 +8,25 @@ fn lorem(ipsum: usize) {} fn lorem(ipsum: usize, dolor: usize, sit: usize, amet: usize, consectetur: usize, adipiscing: usize, elit: usize) { // body } + +// #1922 +extern "C" { + pub fn LAPACKE_csytrs_rook_work(matrix_layout: c_int, + uplo: c_char, + n: lapack_int, + nrhs: lapack_int, + a: *const lapack_complex_float, + lda: lapack_int, ipiv: *const lapack_int, + b: *mut lapack_complex_float, + ldb: lapack_int + )-> lapack_int; + + pub fn LAPACKE_csytrs_rook_work(matrix_layout: c_int, + uplo: c_char, + n: lapack_int, + nrhs: lapack_int, + lda: lapack_int, ipiv: *const lapack_int, + b: *mut lapack_complex_float, + ldb: lapack_int + ) -> lapack_int; +} diff --git a/tests/target/configs-fn_args_layout-visual.rs b/tests/target/configs-fn_args_layout-visual.rs index 834cac446a9..778d6d4fc03 100644 --- a/tests/target/configs-fn_args_layout-visual.rs +++ b/tests/target/configs-fn_args_layout-visual.rs @@ -14,3 +14,27 @@ fn lorem(ipsum: usize, elit: usize) { // body } + +// #1922 +extern "C" { + pub fn LAPACKE_csytrs_rook_work(matrix_layout: c_int, + uplo: c_char, + n: lapack_int, + nrhs: lapack_int, + a: *const lapack_complex_float, + lda: lapack_int, + ipiv: *const lapack_int, + b: *mut lapack_complex_float, + ldb: lapack_int) + -> lapack_int; + + pub fn LAPACKE_csytrs_rook_work(matrix_layout: c_int, + uplo: c_char, + n: lapack_int, + nrhs: lapack_int, + lda: lapack_int, + ipiv: *const lapack_int, + b: *mut lapack_complex_float, + ldb: lapack_int) + -> lapack_int; +}