core-text: Fix some clippy warnings.

This commit is contained in:
Bruce Mitchener
2018-02-04 21:36:56 +07:00
parent 16ddf909ac
commit 2aae249d43
3 changed files with 11 additions and 13 deletions
+5 -6
View File
@@ -270,12 +270,11 @@ impl CTFont {
pub fn get_bounding_rects_for_glyphs(&self, orientation: CTFontOrientation, glyphs: &[CGGlyph])
-> CGRect {
unsafe {
let result = CTFontGetBoundingRectsForGlyphs(self.as_concrete_TypeRef(),
orientation,
glyphs.as_ptr(),
ptr::null_mut(),
glyphs.len() as CFIndex);
result
CTFontGetBoundingRectsForGlyphs(self.as_concrete_TypeRef(),
orientation,
glyphs.as_ptr(),
ptr::null_mut(),
glyphs.len() as CFIndex)
}
}
+1 -2
View File
@@ -19,7 +19,6 @@ use core_foundation::set::CFSet;
use core_foundation::string::{CFString, CFStringRef};
use libc::c_void;
use std::ptr;
#[repr(C)]
pub struct __CTFontCollection(c_void);
@@ -82,7 +81,7 @@ pub fn create_for_family(family: &str) -> Option<CTFontCollection> {
let matched_descs = CTFontDescriptorCreateMatchingFontDescriptors(
wildcard_desc.as_concrete_TypeRef(),
mandatory_attrs.as_concrete_TypeRef());
if matched_descs == ptr::null() {
if matched_descs.is_null() {
return None;
}
let matched_descs = CFArray::wrap_under_create_rule(matched_descs);
+5 -5
View File
@@ -93,23 +93,23 @@ impl StylisticClassAccessors for CTFontStylisticClass {
| kCTFontSlabSerifsClass
| kCTFontFreeformSerifsClass;
return (*self & any_serif_class) != 0;
(*self & any_serif_class) != 0
}
fn is_sans_serif(&self) -> bool {
return (*self & kCTFontSansSerifClass) != 0;
(*self & kCTFontSansSerifClass) != 0
}
fn is_script(&self) -> bool {
return (*self & kCTFontScriptsClass) != 0;
(*self & kCTFontScriptsClass) != 0
}
fn is_fantasy(&self) -> bool {
return (*self & kCTFontOrnamentalsClass) != 0;
(*self & kCTFontOrnamentalsClass) != 0
}
fn is_symbols(&self) -> bool {
return (*self & kCTFontSymbolicClass) != 0;
(*self & kCTFontSymbolicClass) != 0
}
}