#[inline]
pub unsafe fn wrap_under_get_rule(reference: CFPropertyListRef) -> CFPropertyList {
- let reference = mem::transmute(CFRetain(mem::transmute(reference)));
+ let reference = CFRetain(reference);
CFPropertyList(reference)
}
#[inline]
pub fn as_CFTypeRef(&self) -> ::core_foundation_sys::base::CFTypeRef {
- unsafe { mem::transmute(self.as_concrete_TypeRef()) }
+ self.as_concrete_TypeRef()
}
#[inline]
/// // Cast it up to a property list.
/// let propertylist: CFPropertyList = string.to_CFPropertyList();
/// // Cast it down again.
- /// assert!(propertylist.downcast::<CFString>().unwrap().to_string() == "FooBar");
+ /// assert_eq!(propertylist.downcast::<CFString>().unwrap().to_string(), "FooBar");
/// ```
///
/// [`CFPropertyList`]: struct.CFPropertyList.html
let data = create_data(dict1.as_CFTypeRef(), kCFPropertyListXMLFormat_v1_0).unwrap();
let (dict2, _) = create_with_data(data, kCFPropertyListImmutable).unwrap();
unsafe {
- assert!(CFEqual(dict1.as_CFTypeRef(), dict2) == 1);
+ assert_eq!(CFEqual(dict1.as_CFTypeRef(), dict2), 1);
}
}
#[test]
fn downcast_string() {
let propertylist = CFString::from_static_string("Bar").to_CFPropertyList();
- assert!(propertylist.downcast::<CFString>().unwrap().to_string() == "Bar");
+ assert_eq!(propertylist.downcast::<CFString>().unwrap().to_string(), "Bar");
assert!(propertylist.downcast::<CFBoolean>().is_none());
}
assert_eq!(string.retain_count(), 2);
let string2 = propertylist.downcast_into::<CFString>().unwrap();
- assert!(string2.to_string() == "Bar");
+ assert_eq!(string2.to_string(), "Bar");
assert_eq!(string2.retain_count(), 2);
}
}