From c2e8916168220666708fd713815156f71ecb1b71 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 5 Jun 2016 13:20:53 +0200 Subject: [PATCH] Move LowercaseString near its only consumer. --- components/gfx/font_cache_thread.rs | 25 ++++++++++++++++++++++++- components/util/str.rs | 23 ----------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/components/gfx/font_cache_thread.rs b/components/gfx/font_cache_thread.rs index a43490036b9..2a1a1e7764c 100644 --- a/components/gfx/font_cache_thread.rs +++ b/components/gfx/font_cache_thread.rs @@ -17,6 +17,7 @@ use platform::font_template::FontTemplateData; use std::borrow::ToOwned; use std::collections::HashMap; use std::mem; +use std::ops::Deref; use std::sync::{Arc, Mutex}; use std::u32; use string_cache::Atom; @@ -24,7 +25,6 @@ use style::font_face::Source; use style::properties::longhands::font_family::computed_value::FontFamily; use url::Url; use util::prefs; -use util::str::LowercaseString; use util::thread::spawn_named; use webrender_traits; @@ -460,3 +460,26 @@ fn is_supported_font_type(toplevel: &TopLevel, sublevel: &SubLevel) -> bool { _ => false, } } + + +#[derive(Clone, Eq, PartialEq, Hash, Debug, Deserialize, Serialize)] +pub struct LowercaseString { + inner: String, +} + +impl LowercaseString { + pub fn new(s: &str) -> LowercaseString { + LowercaseString { + inner: s.to_lowercase(), + } + } +} + +impl Deref for LowercaseString { + type Target = str; + + #[inline] + fn deref(&self) -> &str { + &*self.inner + } +} diff --git a/components/util/str.rs b/components/util/str.rs index 8ea48f2a3d0..73518625b6e 100644 --- a/components/util/str.rs +++ b/components/util/str.rs @@ -5,7 +5,6 @@ use num_traits::ToPrimitive; use std::convert::AsRef; use std::iter::{Filter, Peekable}; -use std::ops::Deref; use std::str::Split; pub type StaticCharVec = &'static [char]; @@ -117,28 +116,6 @@ pub fn read_exponent>(mut iter: Peekable) -> Option LowercaseString { - LowercaseString { - inner: s.to_lowercase(), - } - } -} - -impl Deref for LowercaseString { - type Target = str; - - #[inline] - fn deref(&self) -> &str { - &*self.inner - } -} - pub fn str_join(strs: I, join: &str) -> String where I: IntoIterator, T: AsRef, {