}
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);
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);
self.shape
.width
.checked_sub(self.opener.len() + self.line_end.len() + 1)?
- + 1;
+ + 1,
)
}
}
}
-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);
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]