diff options
| author | Caleb Cartwright <caleb.cartwright@outlook.com> | 2022-08-06 19:07:02 -0500 |
|---|---|---|
| committer | Caleb Cartwright <caleb.cartwright@outlook.com> | 2022-08-06 19:07:02 -0500 |
| commit | a392dd10cdc4b25850cc9cdda4889ed462c101ff (patch) | |
| tree | 3284bd5335b830cecfb4e2c0cada8b98303c52e4 /src/expr.rs | |
| parent | af72f7a17f01a2d61490556e32c91c2d98416c9b (diff) | |
| parent | 662702eb54b12f16729d6559ce0478b00ef153a8 (diff) | |
Merge remote-tracking branch 'upstream/master' into subtree-sync-2022-08-06
Diffstat (limited to 'src/expr.rs')
| -rw-r--r-- | src/expr.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/expr.rs b/src/expr.rs index a7b73ba78c5..c9d704765c2 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -29,9 +29,9 @@ use crate::spanned::Spanned; use crate::string::{rewrite_string, StringFormat}; use crate::types::{rewrite_path, PathContext}; use crate::utils::{ - colon_spaces, contains_skip, count_newlines, first_line_ends_with, inner_attributes, - last_line_extendable, last_line_width, mk_sp, outer_attributes, semicolon_for_expr, - unicode_str_width, wrap_str, + colon_spaces, contains_skip, count_newlines, filtered_str_fits, first_line_ends_with, + inner_attributes, last_line_extendable, last_line_width, mk_sp, outer_attributes, + semicolon_for_expr, unicode_str_width, wrap_str, }; use crate::vertical::rewrite_with_alignment; use crate::visitor::FmtVisitor; @@ -2043,8 +2043,7 @@ fn choose_rhs<R: Rewrite>( match (orig_rhs, new_rhs) { (Some(ref orig_rhs), Some(ref new_rhs)) - if wrap_str(new_rhs.clone(), context.config.max_width(), new_shape) - .is_none() => + if !filtered_str_fits(&new_rhs, context.config.max_width(), new_shape) => { Some(format!("{}{}", before_space_str, orig_rhs)) } |
