aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-symfony-console/src/formatter
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe-symfony-console/src/formatter')
-rw-r--r--crates/shirabe-symfony-console/src/formatter/output_formatter.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/shirabe-symfony-console/src/formatter/output_formatter.rs b/crates/shirabe-symfony-console/src/formatter/output_formatter.rs
index 571d66c0..256fade1 100644
--- a/crates/shirabe-symfony-console/src/formatter/output_formatter.rs
+++ b/crates/shirabe-symfony-console/src/formatter/output_formatter.rs
@@ -190,9 +190,11 @@ impl OutputFormatter {
prefix = String::new();
}
- let matches = preg_match(php_regex!("~(\\n)$~"), &text).unwrap_or_default();
+ let trailing = preg_match(php_regex!("~(\\n)$~"), &text)
+ .and_then(|matches| matches.get(1))
+ .unwrap_or("")
+ .to_string();
text = format!("{}{}", prefix, self.add_line_breaks(&text, width));
- let trailing = matches.get(1).and_then(|m| m.clone()).unwrap_or_default();
text = format!("{}{}", shirabe_php_shim::rtrim(&text, Some("\n")), trailing);
if *current_line_length == 0