From 39173f66d7aaf891cc2983a87e90bb8586c48426 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 1 Sep 2016 11:49:25 +0200 Subject: [PATCH 1/6] Silence all non_upper_case_globals warnings --- src/base.rs | 1 + src/display.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/base.rs b/src/base.rs index 0ea9795..6c7c33d 100644 --- a/src/base.rs +++ b/src/base.rs @@ -10,6 +10,7 @@ // this file defines CGFloat, as well as stubbed data types. #![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] use libc; diff --git a/src/display.rs b/src/display.rs index 69d13cb..a7f0847 100644 --- a/src/display.rs +++ b/src/display.rs @@ -7,6 +7,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![allow(non_upper_case_globals)] + // this file defines CGFloat, as well as stubbed data types. extern crate core_foundation; // extern crate core_foundation_sys; From 17c0b1ed9ef7d2e7fa016672eefb4676a45e4d5a Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 1 Sep 2016 11:49:45 +0200 Subject: [PATCH 2/6] Remove some useless comment and commented-out code --- src/display.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/display.rs b/src/display.rs index a7f0847..52eec0c 100644 --- a/src/display.rs +++ b/src/display.rs @@ -9,9 +9,7 @@ #![allow(non_upper_case_globals)] -// this file defines CGFloat, as well as stubbed data types. extern crate core_foundation; -// extern crate core_foundation_sys; pub use libc; pub use base::{CGError, boolean_t}; From e2e56e909bdfbcdccb9ee84c042fbacdd8b0e012 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 1 Sep 2016 11:50:19 +0200 Subject: [PATCH 3/6] Remove some unused imports --- src/color_space.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/color_space.rs b/src/color_space.rs index 1947707..4a2ddda 100644 --- a/src/color_space.rs +++ b/src/color_space.rs @@ -8,9 +8,7 @@ // except according to those terms. use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType}; -use libc::{c_void, size_t}; use std::mem; -use std::ptr; #[repr(C)] struct __CGColorSpace; From 66df225fd8a5130ef2f6b5cb06039e7c9599fc3b Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 1 Sep 2016 11:51:28 +0200 Subject: [PATCH 4/6] Silence an unused_variables warning --- src/font.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/font.rs b/src/font.rs index 0ed20c5..fe051be 100644 --- a/src/font.rs +++ b/src/font.rs @@ -41,7 +41,7 @@ impl Serialize for CGFont { impl Deserialize for CGFont { fn deserialize(deserializer: &mut D) -> Result where D: Deserializer { let postscript_name: String = try!(Deserialize::deserialize(deserializer)); - CGFont::from_name(&CFString::new(&*postscript_name)).map_err(|err| { + CGFont::from_name(&CFString::new(&*postscript_name)).map_err(|_| { de::Error::invalid_value("Couldn't find a font with that PostScript name!") }) } From e47505dfa829742a2c1921b363c702a7f49a5e84 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 1 Sep 2016 11:57:12 +0200 Subject: [PATCH 5/6] Don't reexport libc --- src/display.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/display.rs b/src/display.rs index 52eec0c..491e277 100644 --- a/src/display.rs +++ b/src/display.rs @@ -11,7 +11,7 @@ extern crate core_foundation; -pub use libc; +use libc; pub use base::{CGError, boolean_t}; pub use geometry::{CGRect, CGPoint, CGSize}; From e805130b6bec009bbacedd0646bcb88e717f0e51 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 1 Sep 2016 11:58:05 +0200 Subject: [PATCH 6/6] Fix all private_in_public errors --- src/color_space.rs | 2 +- src/context.rs | 2 +- src/data_provider.rs | 2 +- src/font.rs | 2 +- src/private.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/color_space.rs b/src/color_space.rs index 4a2ddda..10a728a 100644 --- a/src/color_space.rs +++ b/src/color_space.rs @@ -11,7 +11,7 @@ use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType}; use std::mem; #[repr(C)] -struct __CGColorSpace; +pub struct __CGColorSpace; pub type CGColorSpaceRef = *const __CGColorSpace; diff --git a/src/context.rs b/src/context.rs index c37fe2a..52987c0 100644 --- a/src/context.rs +++ b/src/context.rs @@ -16,7 +16,7 @@ use std::ptr; use std::slice; #[repr(C)] -struct __CGContext; +pub struct __CGContext; pub type CGContextRef = *const __CGContext; diff --git a/src/data_provider.rs b/src/data_provider.rs index bb2fdba..fe449a2 100644 --- a/src/data_provider.rs +++ b/src/data_provider.rs @@ -26,7 +26,7 @@ pub type CGDataProviderReleaseDataCallback = *const u8; pub type CGDataProviderGetBytesAtPositionCallback = *const u8; #[repr(C)] -struct __CGDataProvider; +pub struct __CGDataProvider; pub type CGDataProviderRef = *const __CGDataProvider; diff --git a/src/font.rs b/src/font.rs index fe051be..e3e2700 100644 --- a/src/font.rs +++ b/src/font.rs @@ -20,7 +20,7 @@ use std::ptr; pub type CGGlyph = libc::c_ushort; #[repr(C)] -struct __CGFont; +pub struct __CGFont; pub type CGFontRef = *const __CGFont; diff --git a/src/private.rs b/src/private.rs index 518c55c..11231a9 100644 --- a/src/private.rs +++ b/src/private.rs @@ -91,7 +91,7 @@ mod ffi { use libc::{c_int, c_uint}; // This is an enum so that we can't easily make instances of this opaque type. - enum CGSRegionObject {} + pub enum CGSRegionObject {} pub type CGError = OSStatus; pub type CGSRegionRef = *mut CGSRegionObject;