about summary refs log tree commit diff
path: root/src/string.rs
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2017-01-06 16:35:28 +1300
committerNick Cameron <ncameron@mozilla.com>2017-01-06 16:35:28 +1300
commit6ecf5b8e844e5d8a35a21b1901e461033da0b9fa (patch)
tree9a730d0d08c4be5377c350231f450f0392628254 /src/string.rs
parent32cb83985541ec78fc17185c0847facf2f5da2ec (diff)
If a string goes over-width, give up formatting it
Logic here is that the original might be better and at best we'll only make it a different kind of bad.

Fixes #1237
Diffstat (limited to 'src/string.rs')
-rw-r--r--src/string.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/string.rs b/src/string.rs
index e90e24f7af2..71d8f8415f0 100644
--- a/src/string.rs
+++ b/src/string.rs
@@ -15,6 +15,7 @@ use regex::Regex;
 
 use Indent;
 use config::Config;
+use utils::wrap_str;
 
 use MIN_STRING;
 
@@ -117,7 +118,7 @@ pub fn rewrite_string<'a>(orig: &str, fmt: &StringFormat<'a>) -> Option<String>
     }
 
     result.push_str(fmt.closer);
-    Some(result)
+    wrap_str(result, fmt.config.max_width, fmt.width, fmt.offset)
 }
 
 #[cfg(test)]