style: Use more Box<[]> and Box<str> for quotes.

This commit is contained in:
Emilio Cobos Álvarez 2017-12-14 03:59:39 +01:00
parent 16f627a18a
commit 03f3521216
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
5 changed files with 50 additions and 31 deletions

View file

@ -7,12 +7,20 @@
pub use values::specified::list::Quotes;
impl Quotes {
/// Initial value for `quotes`
/// Initial value for `quotes`.
///
/// FIXME(emilio): This should ideally not allocate.
#[inline]
pub fn get_initial_value() -> Quotes {
Quotes(vec![
("\u{201c}".to_owned(), "\u{201d}".to_owned()),
("\u{2018}".to_owned(), "\u{2019}".to_owned()),
])
(
"\u{201c}".to_owned().into_boxed_str(),
"\u{201d}".to_owned().into_boxed_str(),
),
(
"\u{2018}".to_owned().into_boxed_str(),
"\u{2019}".to_owned().into_boxed_str(),
),
].into_boxed_slice())
}
}