From 65e213309bb130a02160c371408c1c745083c796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Fri, 14 Sep 2018 18:24:27 +0200 Subject: [PATCH] do not allocate empty strings follow review from @pwoolcoc, and do not use SafeString::new(&::new()) since this makes an allocation which will then just be thrown away. Instead, we pass "" --- plume-models/src/blogs.rs | 4 ++-- plume-models/src/users.rs | 4 ++-- src/routes/instance.rs | 4 ++-- src/setup.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index 9c73a7d6..c825f6aa 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -143,8 +143,8 @@ impl Blog { name: inst.clone(), local: false, // We don't really care about all the following for remote instances - long_description: SafeString::new(&::new()), - short_description: SafeString::new(&::new()), + long_description: SafeString::new(""), + short_description: SafeString::new(""), default_license: String::new(), open_registrations: true, short_description_html: String::new(), diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index 9c2c8113..d8addb19 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -205,8 +205,8 @@ impl User { public_domain: inst.clone(), local: false, // We don't really care about all the following for remote instances - long_description: SafeString::new(&::new()), - short_description: SafeString::new(&::new()), + long_description: SafeString::new(""), + short_description: SafeString::new(""), default_license: String::new(), open_registrations: true, short_description_html: String::new(), diff --git a/src/routes/instance.rs b/src/routes/instance.rs index 6f2a970a..6905ecbc 100644 --- a/src/routes/instance.rs +++ b/src/routes/instance.rs @@ -125,8 +125,8 @@ fn update_settings(conn: DbConn, admin: Admin, form: LenientForm::new()), - short_description: SafeString::new(&::new()), + long_description: SafeString::new(""), + short_description: SafeString::new(""), default_license: String::from("CC-0"), open_registrations: true, short_description_html: String::new(),