From 86018133a02064e838404c94a860e57547a5a9ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Campinas?= Date: Sat, 14 Jul 2018 19:17:07 +0200 Subject: [PATCH] removed unused max_width argument of rewrite_string function --- src/comment.rs | 4 ++-- src/expr.rs | 1 - src/string.rs | 10 +++------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/comment.rs b/src/comment.rs index f684a6291ff..53e496bf457 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -438,7 +438,7 @@ fn rewrite_comment_inner( } if config.wrap_comments() && line.len() > fmt.shape.width && !has_url(line) { - match rewrite_string(line, &fmt, Some(max_chars)) { + match rewrite_string(line, &fmt) { Some(ref s) => { is_prev_line_multi_line = s.contains('\n'); result.push_str(s); @@ -449,7 +449,7 @@ fn rewrite_comment_inner( result.pop(); result.push_str(&comment_line_separator); fmt.shape = Shape::legacy(max_chars, fmt_indent); - match rewrite_string(line, &fmt, Some(max_chars)) { + match rewrite_string(line, &fmt) { Some(ref s) => { is_prev_line_multi_line = s.contains('\n'); result.push_str(s); diff --git a/src/expr.rs b/src/expr.rs index c4675cbcdf7..6e1af266e9b 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1229,7 +1229,6 @@ fn rewrite_string_lit(context: &RewriteContext, span: Span, shape: Shape) -> Opt rewrite_string( str_lit, &StringFormat::new(shape.visual_indent(0), context.config), - None, ) } diff --git a/src/string.rs b/src/string.rs index 387bee3cec9..fd7ac89013a 100644 --- a/src/string.rs +++ b/src/string.rs @@ -51,7 +51,7 @@ fn max_chars_with_indent(&self) -> Option { self.shape .width .checked_sub(self.opener.len() + self.line_end.len() + 1)? - + 1; + + 1, ) } @@ -63,11 +63,7 @@ fn max_chars_without_indent(&self) -> Option { } } -pub fn rewrite_string<'a>( - orig: &str, - fmt: &StringFormat<'a>, - max_width: Option, -) -> Option { +pub fn rewrite_string<'a>(orig: &str, fmt: &StringFormat<'a>) -> Option { let max_chars_with_indent = fmt.max_chars_with_indent()?; let max_chars_without_indent = fmt.max_chars_without_indent()?; let indent = fmt.shape.indent.to_string_with_newline(fmt.config); @@ -235,7 +231,7 @@ mod test { fn issue343() { let config = Default::default(); let fmt = StringFormat::new(Shape::legacy(2, Indent::empty()), &config); - rewrite_string("eq_", &fmt, None); + rewrite_string("eq_", &fmt); } #[test] -- 2.44.0