Skip to content

Commit

Permalink
Run rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Nov 2, 2018
1 parent 569db5f commit 9ffb2c6
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 37 deletions.
4 changes: 2 additions & 2 deletions src/class/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#[macro_use]
mod macros;

pub mod pyasync;
pub mod basic;
pub mod buffer;
pub mod context;
Expand All @@ -15,16 +14,17 @@ pub mod iter;
pub mod mapping;
pub mod methods;
pub mod number;
pub mod pyasync;
pub mod sequence;

pub use self::pyasync::PyAsyncProtocol;
pub use self::basic::PyObjectProtocol;
pub use self::buffer::PyBufferProtocol;
pub use self::context::PyContextProtocol;
pub use self::descr::PyDescrProtocol;
pub use self::iter::PyIterProtocol;
pub use self::mapping::PyMappingProtocol;
pub use self::number::PyNumberProtocol;
pub use self::pyasync::PyAsyncProtocol;
pub use self::sequence::PySequenceProtocol;

pub use self::gc::{PyGCProtocol, PyTraverseError, PyVisit};
Expand Down
2 changes: 1 addition & 1 deletion src/class/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use crate::err::{PyErr, PyResult};
use crate::ffi;
use crate::objectprotocol::ObjectProtocol;
use crate::python::Python;
use std::os::raw::c_int;
use crate::typeob::PyTypeInfo;
use crate::types::{exceptions, PyObjectRef};
use std::os::raw::c_int;

/// Sequece interface
#[allow(unused_variables)]
Expand Down
2 changes: 1 addition & 1 deletion src/derive_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use crate::err::PyResult;
use crate::exceptions::TypeError;
use crate::ffi;
use crate::init_once;
use std::ptr;
use crate::types::PyModule;
use crate::types::{PyDict, PyObjectRef, PyString, PyTuple};
use crate::GILPool;
use crate::Python;
use std::ptr;

#[derive(Debug)]
/// Description of a python parameter; used for `parse_args()`.
Expand Down
8 changes: 6 additions & 2 deletions src/ffi3/ceval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ extern "C" {
// TODO: Py_EnterRecursiveCall etc.

#[cfg(Py_3_6)]
pub type _PyFrameEvalFunction = extern "C" fn(*mut crate::ffi3::PyFrameObject, c_int) -> *mut PyObject;
pub type _PyFrameEvalFunction =
extern "C" fn(*mut crate::ffi3::PyFrameObject, c_int) -> *mut PyObject;

#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
Expand All @@ -54,7 +55,10 @@ extern "C" {
pub fn PyEval_GetCallStats(arg1: *mut PyObject) -> *mut PyObject;
pub fn PyEval_EvalFrame(arg1: *mut crate::ffi3::PyFrameObject) -> *mut PyObject;
#[cfg(Py_3_6)]
pub fn _PyEval_EvalFrameDefault(arg1: *mut crate::ffi3::PyFrameObject, exc: c_int) -> *mut PyObject;
pub fn _PyEval_EvalFrameDefault(
arg1: *mut crate::ffi3::PyFrameObject,
exc: c_int,
) -> *mut PyObject;
#[cfg(Py_3_6)]
pub fn _PyEval_RequestCodeExtraIndex(func: FreeFunc) -> c_int;
pub fn PyEval_EvalFrameEx(f: *mut crate::ffi3::PyFrameObject, exc: c_int) -> *mut PyObject;
Expand Down
2 changes: 1 addition & 1 deletion src/freelist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use crate::err::PyResult;
use crate::ffi;
use crate::python::Python;
use crate::typeob::{pytype_drop, PyObjectAlloc, PyTypeInfo};
use std::mem;
use std::os::raw::c_void;
use crate::typeob::{pytype_drop, PyObjectAlloc, PyTypeInfo};

/// Implementing this trait for custom class adds free allocation list to class.
/// The performance improvement applies to types that are often created and deleted in a row,
Expand Down
4 changes: 2 additions & 2 deletions src/objectprotocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use crate::ffi;
use crate::instance::PyObjectWithToken;
use crate::object::PyObject;
use crate::python::{IntoPyPointer, Python, ToPyPointer};
use crate::typeob::PyTypeInfo;
use crate::types::{PyDict, PyIterator, PyObjectRef, PyString, PyTuple, PyType};
use std;
use std::cmp::Ordering;
use std::os::raw::c_int;
use crate::typeob::PyTypeInfo;
use crate::types::{PyDict, PyIterator, PyObjectRef, PyString, PyTuple, PyType};

/// Python object model helper methods
pub trait ObjectProtocol {
Expand Down
6 changes: 3 additions & 3 deletions src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ use crate::ffi;
use crate::instance::{AsPyRef, Py, PyToken};
use crate::object::PyObject;
use crate::pythonrun::{self, GILGuard};
use crate::typeob::PyTypeCreate;
use crate::typeob::{PyTypeInfo, PyTypeObject};
use crate::types::{PyDict, PyModule, PyObjectRef, PyType};
use std;
use std::ffi::CString;
use std::marker::PhantomData;
use std::os::raw::c_int;
use crate::typeob::PyTypeCreate;
use crate::typeob::{PyTypeInfo, PyTypeObject};
use crate::types::{PyDict, PyModule, PyObjectRef, PyType};

/// Marker type that indicates that the GIL is currently held.
///
Expand Down
2 changes: 1 addition & 1 deletion src/pythonrun.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (c) 2017-present PyO3 Project and Contributors
use crate::ffi;
use crate::python::Python;
use crate::types::PyObjectRef;
use spin;
use std::{any, marker, rc, sync};
use crate::types::PyObjectRef;

static START: sync::Once = sync::ONCE_INIT;
static START_PYO3: sync::Once = sync::ONCE_INIT;
Expand Down
6 changes: 3 additions & 3 deletions src/typeob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ use crate::err::{PyErr, PyResult};
use crate::instance::{Py, PyObjectWithToken, PyToken};
use crate::python::ToPyPointer;
use crate::python::{IntoPyPointer, Python};
use crate::types::PyObjectRef;
use crate::types::PyType;
use crate::{class, ffi, pythonrun};
use std;
use std::collections::HashMap;
use std::ffi::CString;
use std::mem;
use std::os::raw::c_void;
use crate::types::PyObjectRef;
use crate::types::PyType;
use crate::{class, ffi, pythonrun};

/// Python type information.
pub trait PyTypeInfo {
Expand Down
2 changes: 1 addition & 1 deletion src/types/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ use crate::ffi::{
use crate::instance::Py;
use crate::object::PyObject;
use crate::python::{Python, ToPyPointer};
use crate::types::PyTuple;
use std::os::raw::c_int;
use std::ptr;
use crate::types::PyTuple;

/// Access traits
Expand Down
4 changes: 2 additions & 2 deletions src/types/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use crate::ffi;
use crate::instance::PyObjectWithToken;
use crate::object::PyObject;
use crate::python::{IntoPyPointer, Python, ToPyPointer};
use crate::types::{PyList, PyObjectRef};
use std;
use std::{cmp, collections, hash, mem};
use crate::types::{PyList, PyObjectRef};

/// Represents a Python `dict`.
#[repr(transparent)]
Expand Down Expand Up @@ -275,10 +275,10 @@ mod test {
use crate::conversion::{IntoPyObject, PyTryFrom, ToPyObject};
use crate::instance::AsPyRef;
use crate::python::Python;
use std::collections::{BTreeMap, HashMap};
use crate::types::dict::IntoPyDict;
use crate::types::{PyDict, PyList, PyTuple};
use crate::ObjectProtocol;
use std::collections::{BTreeMap, HashMap};

#[test]
fn test_new() {
Expand Down
4 changes: 2 additions & 2 deletions src/types/exceptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use crate::err::{PyErr, PyResult};
use crate::ffi;
use crate::instance::Py;
use crate::python::{Python, ToPyPointer};
use crate::typeob::PyTypeObject;
use crate::types::{PyObjectRef, PyTuple, PyType};
use std::ffi::CStr;
use std::os::raw::c_char;
use std::{self, ops};
use crate::typeob::PyTypeObject;
use crate::types::{PyObjectRef, PyTuple, PyType};

// Copyright (c) 2017-present PyO3 Project and Contributors

Expand Down
2 changes: 1 addition & 1 deletion src/types/floatob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use crate::instance::{Py, PyObjectWithToken};
use crate::object::PyObject;
use crate::objectprotocol::ObjectProtocol;
use crate::python::{Python, ToPyPointer};
use std::os::raw::c_double;
use crate::types::PyObjectRef;
use crate::FromPyObject;
use crate::PyResult;
use std::os::raw::c_double;

/// Represents a Python `float` object.
///
Expand Down
10 changes: 2 additions & 8 deletions src/types/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ mod tests {
use crate::objectprotocol::ObjectProtocol;
use crate::python::Python;
use crate::pythonrun::GILPool;
use crate::types::{PyList, PyObjectRef};
use crate::types::{PyDict, PyList, PyObjectRef};
use crate::GILGuard;

#[test]
fn vec_iter() {
Expand Down Expand Up @@ -135,13 +136,6 @@ mod tests {
}
assert_eq!(count, none.get_refcnt());
}
}

#[cfg(test)]
mod test {
use crate::objectprotocol::ObjectProtocol;
use crate::GILGuard;
use crate::types::PyDict;

#[test]
fn fibonacci_generator() {
Expand Down
4 changes: 2 additions & 2 deletions src/types/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use crate::instance::PyObjectWithToken;
use crate::object::PyObject;
use crate::objectprotocol::ObjectProtocol;
use crate::python::{Python, ToPyPointer};
use crate::typeob::{initialize_type, PyTypeInfo};
use crate::types::{exceptions, PyDict, PyObjectRef, PyType};
use std::ffi::{CStr, CString};
use std::os::raw::c_char;
use std::str;
use crate::typeob::{initialize_type, PyTypeInfo};
use crate::types::{exceptions, PyDict, PyObjectRef, PyType};

/// Represents a Python `module` object.
#[repr(transparent)]
Expand Down
2 changes: 1 addition & 1 deletion src/types/num3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use crate::ffi;
use crate::instance::PyObjectWithToken;
use crate::object::PyObject;
use crate::python::{Python, ToPyPointer};
use crate::types::{exceptions, PyObjectRef};
use std::i64;
use std::os::raw::{c_long, c_uchar};
use crate::types::{exceptions, PyObjectRef};

/// Represents a Python `int` object.
///
Expand Down
2 changes: 1 addition & 1 deletion src/types/num_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ mod test {
fn test_u128_overflow() {
use crate::ffi;
use crate::object::PyObject;
use std::os::raw::c_uchar;
use crate::types::exceptions;
use std::os::raw::c_uchar;
let gil = Python::acquire_gil();
let py = gil.python();
let overflow_bytes: [c_uchar; 20] = [255; 20];
Expand Down
2 changes: 1 addition & 1 deletion src/types/stringutils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use crate::err::PyResult;
use crate::instance::PyObjectWithToken;
use crate::object::PyObject;
use crate::python::Python;
use std::borrow::Cow;
use crate::types::{PyObjectRef, PyString};
use crate::FromPyObject;
use std::borrow::Cow;

/// Converts Rust `str` to Python object.
/// See `PyString::new` for details on the conversion.
Expand Down
4 changes: 2 additions & 2 deletions src/types/tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::ffi::{self, Py_ssize_t};
use crate::instance::{AsPyRef, Py, PyObjectWithToken};
use crate::object::PyObject;
use crate::python::{IntoPyPointer, Python, ToPyPointer};
use std::slice;
use crate::types::PyObjectRef;
use std::slice;

/// Represents a Python `tuple` object.
#[repr(transparent)]
Expand Down Expand Up @@ -269,9 +269,9 @@ mod test {
use crate::instance::AsPyRef;
use crate::objectprotocol::ObjectProtocol;
use crate::python::Python;
use std::collections::HashSet;
use crate::types::PyObjectRef;
use crate::types::PyTuple;
use std::collections::HashSet;

#[test]
fn test_new() {
Expand Down

0 comments on commit 9ffb2c6

Please sign in to comment.