mirror of
https://github.com/servo/servo.git
synced 2025-06-24 09:04:33 +01:00
Remove workaround for impl methods not being affected by cfg directives.
This commit is contained in:
parent
a2589dbfec
commit
8329d282d4
3 changed files with 6 additions and 18 deletions
|
@ -31,17 +31,13 @@ pub type FontHandle/& = freetype::font::FreeTypeFontHandle;
|
|||
// TODO(Issue #163): this is a workaround for static methods and
|
||||
// typedefs not working well together. It should be removed.
|
||||
|
||||
// TODO(Rust #1723): #cfg doesn't work for impl methods, so we have
|
||||
// to conditionally define the entire impl.
|
||||
#[cfg(target_os = "macos")]
|
||||
impl FontHandle {
|
||||
#[cfg(target_os = "macos")]
|
||||
static pub fn new(fctx: &native::FontContextHandle, buf: @~[u8], pt_size: float) -> Result<FontHandle, ()> {
|
||||
quartz::font::QuartzFontHandle::new(fctx, buf, pt_size)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
impl FontHandle {
|
||||
static pub fn new(fctx: &native::FontContextHandle, buf: @~[u8], pt_size: float) -> Result<FontHandle, ()> {
|
||||
freetype::font::FreeTypeFontHandle::new(fctx, buf, pt_size)
|
||||
}
|
||||
|
|
|
@ -31,25 +31,19 @@ pub fn dummy_style() -> FontStyle {
|
|||
|
||||
// TODO(Issue #163): this is a workaround for static methods and
|
||||
// typedefs not working well together. It should be removed.
|
||||
|
||||
// TODO(Rust #1723): #cfg doesn't work for impl methods, so we have
|
||||
// to conditionally define the entire impl.
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
type FontContextHandle/& = quartz::font_context::QuartzFontContextHandle;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
type FontContextHandle/& = freetype::font_context::FreeTypeFontContextHandle;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub impl FontContextHandle {
|
||||
#[cfg(target_os = "macos")]
|
||||
static pub fn new() -> FontContextHandle {
|
||||
quartz::font_context::QuartzFontContextHandle::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub impl FontContextHandle {
|
||||
static pub fn new() -> FontContextHandle {
|
||||
freetype::font_context::FreeTypeFontContextHandle::new()
|
||||
}
|
||||
|
|
|
@ -4,15 +4,13 @@ type FontListHandle/& = quartz::font_list::QuartzFontListHandle;
|
|||
#[cfg(target_os = "linux")]
|
||||
type FontListHandle/& = freetype::font_list::FreeTypeFontListHandle;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub impl FontListHandle {
|
||||
#[cfg(target_os = "macos")]
|
||||
static pub fn new() -> FontListHandle {
|
||||
quartz::font_list::QuartzFontListHandle::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub impl FontListHandle {
|
||||
static pub fn new() -> FontListHandle {
|
||||
freetype::font_list::FreeTypeFontListHandle::new()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue