]> git.lizzy.rs Git - rust.git/commitdiff
removed unused max_width argument of rewrite_string function
authorStéphane Campinas <stephane.campinas@gmail.com>
Sat, 14 Jul 2018 17:17:07 +0000 (19:17 +0200)
committerStéphane Campinas <stephane.campinas@gmail.com>
Sat, 14 Jul 2018 17:33:26 +0000 (19:33 +0200)
src/comment.rs
src/expr.rs
src/string.rs

index f684a6291fff6a7c90dd67fa76798dbb36c6a6d7..53e496bf45748be45f6dbf368a954b7fc903b53c 100644 (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);
index c4675cbcdf7ebd0a1659ed470a0322d2dd78cd96..6e1af266e9bfe8e9dfb95470a6fc1e3edef01c5a 100644 (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,
     )
 }
 
index 387bee3cec905bdf475b20764d20a5119736cc61..fd7ac89013a32cba04c94a37bd7cbd2a1bc0df62 100644 (file)
@@ -51,7 +51,7 @@ fn max_chars_with_indent(&self) -> Option<usize> {
             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<usize> {
     }
 }
 
-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]