Add clippy to travis
This commit is contained in:
parent
3de622cdfd
commit
42f84ff881
|
@ -19,6 +19,8 @@ _latest() {
|
|||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=$TRAVIS_RUST_VERSION
|
||||
export PATH=$PATH:$HOME/.cargo/bin
|
||||
|
||||
rustup component add clippy-preview
|
||||
|
||||
|
||||
### Setup kcov #################################################################
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
set -ex
|
||||
|
||||
cargo build --features $FEATURES
|
||||
cargo clippy --features $FEATURES
|
||||
cargo test --features $FEATURES
|
||||
|
||||
for example in examples/*; do
|
||||
|
|
|
@ -545,6 +545,7 @@ impl Clone for PyHeapTypeObject {
|
|||
|
||||
// access macro to the members which are floating "behind" the object
|
||||
#[inline]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
|
||||
pub unsafe fn PyHeapType_GET_MEMBERS(
|
||||
etype: *mut PyHeapTypeObject,
|
||||
) -> *mut ffi2::structmember::PyMemberDef {
|
||||
|
@ -671,6 +672,8 @@ extern "C" {
|
|||
// Flag bits for printing:
|
||||
pub const Py_PRINT_RAW: c_int = 1; // No string quotes etc.
|
||||
|
||||
// https://github.com/rust-lang-nursery/rust-clippy/issues/3430
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(clippy::identity_op))]
|
||||
// PyBufferProcs contains bf_getcharbuffer
|
||||
pub const Py_TPFLAGS_HAVE_GETCHARBUFFER: c_long = (1 << 0);
|
||||
|
||||
|
@ -745,8 +748,7 @@ pub const Py_TPFLAGS_DEFAULT: c_long = (Py_TPFLAGS_HAVE_GETCHARBUFFER
|
|||
| Py_TPFLAGS_HAVE_ITER
|
||||
| Py_TPFLAGS_HAVE_CLASS
|
||||
| Py_TPFLAGS_HAVE_STACKLESS_EXTENSION
|
||||
| Py_TPFLAGS_HAVE_INDEX
|
||||
| 0);
|
||||
| Py_TPFLAGS_HAVE_INDEX);
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn PyType_HasFeature(t: *mut PyTypeObject, f: c_long) -> c_int {
|
||||
|
|
|
@ -54,6 +54,7 @@ pub unsafe fn PyType_SUPPORTS_WEAKREFS(t: *mut PyTypeObject) -> c_int {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
|
||||
pub unsafe fn PyObject_GET_WEAKREFS_LISTPTR(o: *mut PyObject) -> *mut *mut PyObject {
|
||||
let weaklistoffset = (*Py_TYPE(o)).tp_weaklistoffset as isize;
|
||||
(o as *mut c_char).offset(weaklistoffset) as *mut *mut PyObject
|
||||
|
|
|
@ -491,7 +491,7 @@ fn py_class_flags<T: PyTypeInfo>(type_object: &mut ffi::PyTypeObject) {
|
|||
type_object.tp_flags = ffi::Py_TPFLAGS_DEFAULT | ffi::Py_TPFLAGS_CHECKTYPES;
|
||||
}
|
||||
if !type_object.tp_as_buffer.is_null() {
|
||||
type_object.tp_flags = type_object.tp_flags | ffi::Py_TPFLAGS_HAVE_NEWBUFFER;
|
||||
type_object.tp_flags |= ffi::Py_TPFLAGS_HAVE_NEWBUFFER;
|
||||
}
|
||||
if T::FLAGS & PY_TYPE_FLAG_BASETYPE != 0 {
|
||||
type_object.tp_flags |= ffi::Py_TPFLAGS_BASETYPE;
|
||||
|
|
|
@ -11,10 +11,10 @@ use crate::objectprotocol::ObjectProtocol;
|
|||
use crate::python::{Python, ToPyPointer};
|
||||
use crate::typeob::{initialize_type, PyTypeInfo};
|
||||
use crate::types::{exceptions, PyDict, PyObjectRef, PyType};
|
||||
use crate::PyObjectAlloc;
|
||||
use std::ffi::{CStr, CString};
|
||||
use std::os::raw::c_char;
|
||||
use std::str;
|
||||
use PyObjectAlloc;
|
||||
|
||||
/// Represents a Python `module` object.
|
||||
#[repr(transparent)]
|
||||
|
|
|
@ -35,7 +35,7 @@ impl PyType {
|
|||
/// Undefined behavior if the pointer is NULL or invalid.
|
||||
#[inline]
|
||||
pub unsafe fn from_type_ptr(py: Python, p: *mut ffi::PyTypeObject) -> &PyType {
|
||||
py.from_borrowed_ptr::<PyType>(p as *mut ffi::PyObject)
|
||||
py.from_borrowed_ptr(p as *mut ffi::PyObject)
|
||||
}
|
||||
|
||||
/// Gets the name of the PyType.
|
||||
|
|
Loading…
Reference in New Issue