removed unused max_width argument of rewrite_string function

This commit is contained in:
Stéphane Campinas 2018-07-14 19:17:07 +02:00
parent 472a2ed0f6
commit 86018133a0
No known key found for this signature in database
GPG Key ID: 6D5620D908210133
3 changed files with 5 additions and 10 deletions

View File

@ -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);

View File

@ -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,
)
}

View File

@ -51,7 +51,7 @@ impl<'a> StringFormat<'a> {
self.shape
.width
.checked_sub(self.opener.len() + self.line_end.len() + 1)?
+ 1;
+ 1,
)
}
@ -63,11 +63,7 @@ impl<'a> StringFormat<'a> {
}
}
pub fn rewrite_string<'a>(
orig: &str,
fmt: &StringFormat<'a>,
max_width: Option<usize>,
) -> Option<String> {
pub fn rewrite_string<'a>(orig: &str, fmt: &StringFormat<'a>) -> Option<String> {
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]