From ede63e8538929a4a5c079950f2712f81d6b4e2fa Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Fri, 13 Apr 2018 18:25:10 +0000 Subject: [PATCH] Simplified Rust code to use += operator instead of String.push_str(). --- rust/src/lib.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rust/src/lib.rs b/rust/src/lib.rs index d4b41ae..d11fb41 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -238,13 +238,13 @@ impl QrCode { pub fn to_svg_string(&self, border: i32) -> String { assert!(border >= 0, "Border must be non-negative"); let mut result: String = String::new(); - result.push_str("\n"); - result.push_str("\n"); + result += "\n"; + result += "\n"; let dimension = self.size.checked_add(border.checked_mul(2).unwrap()).unwrap(); - result.push_str(&format!( - "\n", dimension)); - result.push_str("\t\n"); - result.push_str("\t\n", dimension); + result += "\t\n"; + result += "\t\n"); - result.push_str("\n"); + result += "\" fill=\"#000000\"/>\n"; + result += "\n"; result }