about summary refs log tree commit diff
path: root/src/librustdoc/passes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustdoc/passes.rs')
-rw-r--r--src/librustdoc/passes.rs27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs
index 2b8f01cfac8..4fc47d64e57 100644
--- a/src/librustdoc/passes.rs
+++ b/src/librustdoc/passes.rs
@@ -311,20 +311,19 @@ pub fn unindent(s: &str) -> ~str {
         }
     });
 
-    match lines {
-        [head, .. tail] => {
-            let mut unindented = ~[ head.trim() ];
-            unindented.push_all(tail.map(|&line| {
-                if line.is_whitespace() {
-                    line
-                } else {
-                    assert!(line.len() >= min_indent);
-                    line.slice_from(min_indent)
-                }
-            }));
-            unindented.connect("\n")
-        }
-        [] => s.to_owned()
+    if lines.len() >= 1 {
+        let mut unindented = ~[ lines[0].trim() ];
+        unindented.push_all(lines.tail().map(|&line| {
+            if line.is_whitespace() {
+                line
+            } else {
+                assert!(line.len() >= min_indent);
+                line.slice_from(min_indent)
+            }
+        }));
+        unindented.connect("\n")
+    } else {
+        s.to_owned()
     }
 }