Skip to content

Commit 5bac2d8

Browse files
committed
Updated for the trivial_casts lint in the latest rust.
1 parent 2ebb16b commit 5bac2d8

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

examples/custom_class.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ impl INSObject for MYObject {
4848
}
4949

5050
unsafe {
51-
decl.add_method(sel!(setNumber:),
52-
my_object_set_number as extern fn(&mut Object, Sel, u32));
53-
decl.add_method(sel!(number),
54-
my_object_get_number as extern fn(&Object, Sel) -> u32);
51+
let set_number: extern fn(&mut Object, Sel, u32) = my_object_set_number;
52+
decl.add_method(sel!(setNumber:), set_number);
53+
let get_number: extern fn(&Object, Sel) -> u32 = my_object_get_number;
54+
decl.add_method(sel!(number), get_number);
5555
}
5656

5757
decl.register();

src/array.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ pub trait INSArray : INSObject {
120120

121121
fn into_vec(array: Id<Self>) -> Vec<Id<Self::Item, Self::Own>> {
122122
array.to_vec().into_iter().map(|obj| unsafe {
123-
Id::from_ptr(obj as *const Self::Item as *mut Self::Item)
123+
let obj_ptr: *const Self::Item = obj;
124+
Id::from_ptr(obj_ptr as *mut Self::Item)
124125
}).collect()
125126
}
126127

@@ -151,7 +152,8 @@ pub trait INSArray : INSObject {
151152
fn to_shared_vec(&self) -> Vec<ShareId<Self::Item>>
152153
where Self: INSArray<Own=Shared> {
153154
self.to_vec().into_iter().map(|obj| unsafe {
154-
Id::from_ptr(obj as *const Self::Item as *mut Self::Item)
155+
let obj_ptr: *const Self::Item = obj;
156+
Id::from_ptr(obj_ptr as *mut Self::Item)
155157
}).collect()
156158
}
157159
}

src/enumerator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ impl<'a, C: INSFastEnumeration> NSFastEnumerator<'a, C> {
102102
// Check if the collection was mutated
103103
if let Some(mutations) = mutations {
104104
assert!(mutations == unsafe { *self.state.mutations_ptr },
105-
"Mutation detected during enumeration of object {:?}",
106-
self.object as *const C);
105+
"Mutation detected during enumeration of object {:p}",
106+
self.object);
107107
}
108108

109109
self.ptr = buf.as_ptr();

src/object.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ mod tests {
7575
fn test_description() {
7676
let obj = NSObject::new();
7777
let description = obj.description();
78-
let expected = format!("<NSObject: {:?}>", &*obj as *const NSObject);
78+
let expected = format!("<NSObject: {:p}>", &*obj);
7979
assert!(description.as_str() == expected.as_slice());
8080
}
8181

0 commit comments

Comments
 (0)