do not allocate empty strings
follow review from @pwoolcoc, and do not use SafeString::new(&<String>::new()) since this makes an allocation which will then just be thrown away. Instead, we pass ""
This commit is contained in:
parent
f5c299f23c
commit
65e213309b
|
@ -143,8 +143,8 @@ impl Blog {
|
||||||
name: inst.clone(),
|
name: inst.clone(),
|
||||||
local: false,
|
local: false,
|
||||||
// We don't really care about all the following for remote instances
|
// We don't really care about all the following for remote instances
|
||||||
long_description: SafeString::new(&<String>::new()),
|
long_description: SafeString::new(""),
|
||||||
short_description: SafeString::new(&<String>::new()),
|
short_description: SafeString::new(""),
|
||||||
default_license: String::new(),
|
default_license: String::new(),
|
||||||
open_registrations: true,
|
open_registrations: true,
|
||||||
short_description_html: String::new(),
|
short_description_html: String::new(),
|
||||||
|
|
|
@ -205,8 +205,8 @@ impl User {
|
||||||
public_domain: inst.clone(),
|
public_domain: inst.clone(),
|
||||||
local: false,
|
local: false,
|
||||||
// We don't really care about all the following for remote instances
|
// We don't really care about all the following for remote instances
|
||||||
long_description: SafeString::new(&<String>::new()),
|
long_description: SafeString::new(""),
|
||||||
short_description: SafeString::new(&<String>::new()),
|
short_description: SafeString::new(""),
|
||||||
default_license: String::new(),
|
default_license: String::new(),
|
||||||
open_registrations: true,
|
open_registrations: true,
|
||||||
short_description_html: String::new(),
|
short_description_html: String::new(),
|
||||||
|
|
|
@ -125,8 +125,8 @@ fn update_settings(conn: DbConn, admin: Admin, form: LenientForm<InstanceSetting
|
||||||
instance.update(&*conn,
|
instance.update(&*conn,
|
||||||
form.name.clone(),
|
form.name.clone(),
|
||||||
form.open_registrations,
|
form.open_registrations,
|
||||||
form.short_description.clone().to_string(),
|
form.short_description.clone(),
|
||||||
form.long_description.clone().to_string());
|
form.long_description.clone());
|
||||||
Redirect::to(uri!(admin))
|
Redirect::to(uri!(admin))
|
||||||
})
|
})
|
||||||
.map_err(|e| Template::render("instance/admin", json!({
|
.map_err(|e| Template::render("instance/admin", json!({
|
||||||
|
|
|
@ -153,8 +153,8 @@ fn quick_setup(conn: DbConn) {
|
||||||
public_domain: domain,
|
public_domain: domain,
|
||||||
name: name,
|
name: name,
|
||||||
local: true,
|
local: true,
|
||||||
long_description: SafeString::new(&<String>::new()),
|
long_description: SafeString::new(""),
|
||||||
short_description: SafeString::new(&<String>::new()),
|
short_description: SafeString::new(""),
|
||||||
default_license: String::from("CC-0"),
|
default_license: String::from("CC-0"),
|
||||||
open_registrations: true,
|
open_registrations: true,
|
||||||
short_description_html: String::new(),
|
short_description_html: String::new(),
|
||||||
|
|
Loading…
Reference in New Issue