Some more clippy warning fixes

[rustfix](https://github.com/killercup/rustfix) makes it much easier.
This commit is contained in:
messense 2017-07-18 22:10:56 +08:00
parent e69163344a
commit 5a8fd2febc
No known key found for this signature in database
GPG Key ID: BB41A8A2C716CCA9
5 changed files with 8 additions and 8 deletions

View File

@ -151,7 +151,7 @@ fn impl_class(cls: &syn::Ident, base: &syn::Ident,
<#cls as _pyo3::typeob::PyTypeObject>::init_type(
_pyo3::Python::assume_gil_acquired());
}
std::mem::transmute(FREELIST)
&mut *FREELIST
}
}
}

View File

@ -101,7 +101,7 @@ impl PyGetterDef {
dst.name = CString::new(self.name).expect(
"Method name must not contain NULL byte").into_raw();
}
dst.get = Some(self.meth.clone());
dst.get = Some(self.meth);
}
}

View File

@ -213,7 +213,7 @@ impl AsPyRef<PyObjectRef> for PyObject {
}
#[inline]
fn as_mut(&self, _py: Python) -> &mut PyObjectRef {
unsafe {std::mem::transmute(self as *const _ as *mut PyObjectRef)}
unsafe {&mut *(self as *const _ as *mut PyObjectRef)}
}
}

View File

@ -216,7 +216,7 @@ pub unsafe fn register_pointer(obj: *mut ffi::PyObject)
pub unsafe fn register_owned(_py: Python, obj: *mut ffi::PyObject) -> &PyObjectRef
{
let pool: &'static mut Pointers = mem::transmute(POINTERS);
let pool: &'static mut Pointers = &mut *POINTERS;
pool.owned.push(obj);
mem::transmute(&pool.owned[pool.owned.len()-1])
}

View File

@ -225,13 +225,13 @@ fn data_is_dropped() {
member2: TestDropCall { drop_called: drop_called2.clone() },
token: t
}).unwrap();
assert!(drop_called1.load(Ordering::Relaxed) == false);
assert!(drop_called2.load(Ordering::Relaxed) == false);
assert!(!drop_called1.load(Ordering::Relaxed));
assert!(!drop_called2.load(Ordering::Relaxed));
drop(inst);
}
assert!(drop_called1.load(Ordering::Relaxed) == true);
assert!(drop_called2.load(Ordering::Relaxed) == true);
assert!(drop_called1.load(Ordering::Relaxed));
assert!(drop_called2.load(Ordering::Relaxed));
}
#[py::class]