Skip to content

Commit 8b27f1e

Browse files
committed
Get ready for rust 2018
1 parent dbaa2de commit 8b27f1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+546
-546
lines changed

src/buffer.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ use std::ffi::CStr;
2222
use std::os::raw;
2323
use std::{cell, mem, slice};
2424

25-
use err::{self, PyResult};
26-
use exceptions;
27-
use ffi;
28-
use python::{Python, ToPyPointer};
29-
use types::PyObjectRef;
25+
use crate::err::{self, PyResult};
26+
use crate::exceptions;
27+
use crate::ffi;
28+
use crate::python::{Python, ToPyPointer};
29+
use crate::types::PyObjectRef;
3030

3131
/// Allows access to the underlying buffer used by a python object such as `bytes`, `bytearray` or `array.array`.
3232
#[repr(transparent)]
@@ -661,17 +661,17 @@ impl_element!(f64, Float);
661661
#[cfg(test)]
662662
mod test {
663663
use super::PyBuffer;
664-
use python::Python;
664+
use crate::python::Python;
665665
use std;
666666

667667
#[allow(unused_imports)]
668-
use objectprotocol::ObjectProtocol;
668+
use crate::objectprotocol::ObjectProtocol;
669669

670670
#[test]
671671
fn test_compatible_size() {
672672
// for the cast in PyBuffer::shape()
673673
assert_eq!(
674-
std::mem::size_of::<::ffi::Py_ssize_t>(),
674+
std::mem::size_of::<crate::ffi::Py_ssize_t>(),
675675
std::mem::size_of::<usize>()
676676
);
677677
}

src/callback.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
use std::os::raw::c_int;
66
use std::{isize, ptr};
77

8-
use conversion::IntoPyObject;
9-
use err::PyResult;
10-
use ffi::{self, Py_hash_t};
11-
use python::{IntoPyPointer, Python};
12-
use types::exceptions::OverflowError;
8+
use crate::conversion::IntoPyObject;
9+
use crate::err::PyResult;
10+
use crate::ffi::{self, Py_hash_t};
11+
use crate::python::{IntoPyPointer, Python};
12+
use crate::types::exceptions::OverflowError;
1313

1414
pub trait CallbackConverter<S> {
1515
type R;

src/class/basic.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
use std::os::raw::c_int;
1212
use std::ptr;
1313

14-
use callback::{BoolCallbackConverter, HashConverter, PyObjectCallbackConverter};
15-
use class::methods::PyMethodDef;
16-
use conversion::{FromPyObject, IntoPyObject};
17-
use err::{PyErr, PyResult};
18-
use ffi;
19-
use objectprotocol::ObjectProtocol;
20-
use python::{IntoPyPointer, Python};
21-
use typeob::PyTypeInfo;
22-
use types::{exceptions, PyObjectRef};
23-
use CompareOp;
14+
use crate::callback::{BoolCallbackConverter, HashConverter, PyObjectCallbackConverter};
15+
use crate::class::methods::PyMethodDef;
16+
use crate::conversion::{FromPyObject, IntoPyObject};
17+
use crate::err::{PyErr, PyResult};
18+
use crate::ffi;
19+
use crate::objectprotocol::ObjectProtocol;
20+
use crate::python::{IntoPyPointer, Python};
21+
use crate::typeob::PyTypeInfo;
22+
use crate::types::{exceptions, PyObjectRef};
23+
use crate::CompareOp;
2424

2525
/// Basic python class customization
2626
#[allow(unused_variables)]
@@ -426,7 +426,7 @@ where
426426
where
427427
T: for<'p> PyObjectRichcmpProtocol<'p>,
428428
{
429-
let _pool = ::GILPool::new();
429+
let _pool = crate::GILPool::new();
430430
let py = Python::assume_gil_acquired();
431431
let slf = py.from_borrowed_ptr::<T>(slf);
432432
let arg = py.from_borrowed_ptr::<PyObjectRef>(arg);

src/class/buffer.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
//! c-api
77
use std::os::raw::c_int;
88

9-
use callback::UnitCallbackConverter;
10-
use err::PyResult;
11-
use ffi;
12-
use typeob::PyTypeInfo;
9+
use crate::callback::UnitCallbackConverter;
10+
use crate::err::PyResult;
11+
use crate::ffi;
12+
use crate::typeob::PyTypeInfo;
1313

1414
/// Buffer protocol interface
1515
///
@@ -85,12 +85,12 @@ where
8585
where
8686
T: for<'p> PyBufferGetBufferProtocol<'p>,
8787
{
88-
let _pool = ::GILPool::new();
89-
let py = ::Python::assume_gil_acquired();
88+
let _pool = crate::GILPool::new();
89+
let py = crate::Python::assume_gil_acquired();
9090
let slf = py.mut_from_borrowed_ptr::<T>(slf);
9191

9292
let result = slf.bf_getbuffer(arg1, arg2).into();
93-
::callback::cb_convert(UnitCallbackConverter, py, result)
93+
crate::callback::cb_convert(UnitCallbackConverter, py, result)
9494
}
9595
Some(wrap::<T>)
9696
}

src/class/context.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
//! Trait and support implementation for context manager api
55
//!
66
7-
use class::methods::PyMethodDef;
8-
use err::PyResult;
9-
use typeob::PyTypeInfo;
7+
use crate::class::methods::PyMethodDef;
8+
use crate::err::PyResult;
9+
use crate::typeob::PyTypeInfo;
1010

1111
/// Context manager interface
1212
#[allow(unused_variables)]
@@ -32,15 +32,15 @@ pub trait PyContextProtocol<'p>: PyTypeInfo {
3232
}
3333

3434
pub trait PyContextEnterProtocol<'p>: PyContextProtocol<'p> {
35-
type Success: ::IntoPyObject;
35+
type Success: crate::IntoPyObject;
3636
type Result: Into<PyResult<Self::Success>>;
3737
}
3838

3939
pub trait PyContextExitProtocol<'p>: PyContextProtocol<'p> {
40-
type ExcType: ::FromPyObject<'p>;
41-
type ExcValue: ::FromPyObject<'p>;
42-
type Traceback: ::FromPyObject<'p>;
43-
type Success: ::IntoPyObject;
40+
type ExcType: crate::FromPyObject<'p>;
41+
type ExcValue: crate::FromPyObject<'p>;
42+
type Traceback: crate::FromPyObject<'p>;
43+
type Success: crate::IntoPyObject;
4444
type Result: Into<PyResult<Self::Success>>;
4545
}
4646

src/class/descr.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
88
use std::os::raw::c_int;
99

10-
use callback::{PyObjectCallbackConverter, UnitCallbackConverter};
11-
use class::methods::PyMethodDef;
12-
use conversion::{FromPyObject, IntoPyObject};
13-
use err::PyResult;
14-
use ffi;
15-
use typeob::PyTypeInfo;
16-
use types::{PyObjectRef, PyType};
10+
use crate::callback::{PyObjectCallbackConverter, UnitCallbackConverter};
11+
use crate::class::methods::PyMethodDef;
12+
use crate::conversion::{FromPyObject, IntoPyObject};
13+
use crate::err::PyResult;
14+
use crate::ffi;
15+
use crate::typeob::PyTypeInfo;
16+
use crate::types::{PyObjectRef, PyType};
1717

1818
/// Descriptor interface
1919
#[allow(unused_variables)]

src/class/gc.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
66
use std::os::raw::{c_int, c_void};
77

8-
use ffi;
9-
use python::{Python, ToPyPointer};
10-
use typeob::PyTypeInfo;
8+
use crate::ffi;
9+
use crate::python::{Python, ToPyPointer};
10+
use crate::typeob::PyTypeInfo;
1111

1212
#[repr(transparent)]
1313
pub struct PyTraverseError(c_int);
@@ -91,7 +91,7 @@ where
9191
where
9292
T: for<'p> PyGCTraverseProtocol<'p>,
9393
{
94-
let _pool = ::GILPool::new();
94+
let _pool = crate::GILPool::new();
9595
let py = Python::assume_gil_acquired();
9696
let slf = py.mut_from_borrowed_ptr::<T>(slf);
9797

@@ -128,7 +128,7 @@ where
128128
where
129129
T: for<'p> PyGCClearProtocol<'p>,
130130
{
131-
let _pool = ::GILPool::new();
131+
let _pool = crate::GILPool::new();
132132
let py = Python::assume_gil_acquired();
133133
let slf = py.mut_from_borrowed_ptr::<T>(slf);
134134

src/class/iter.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
55
use std::ptr;
66

7-
use callback::{CallbackConverter, PyObjectCallbackConverter};
8-
use conversion::IntoPyObject;
9-
use err::PyResult;
10-
use ffi;
11-
use python::{IntoPyPointer, Python};
12-
use typeob::PyTypeInfo;
7+
use crate::callback::{CallbackConverter, PyObjectCallbackConverter};
8+
use crate::conversion::IntoPyObject;
9+
use crate::err::PyResult;
10+
use crate::ffi;
11+
use crate::python::{IntoPyPointer, Python};
12+
use crate::typeob::PyTypeInfo;
1313

1414
/// Python Iterator Interface.
1515
///
@@ -33,12 +33,12 @@ pub trait PyIterProtocol<'p>: PyTypeInfo {
3333
}
3434

3535
pub trait PyIterIterProtocol<'p>: PyIterProtocol<'p> {
36-
type Success: ::IntoPyObject;
36+
type Success: crate::IntoPyObject;
3737
type Result: Into<PyResult<Self::Success>>;
3838
}
3939

4040
pub trait PyIterNextProtocol<'p>: PyIterProtocol<'p> {
41-
type Success: ::IntoPyObject;
41+
type Success: crate::IntoPyObject;
4242
type Result: Into<PyResult<Option<Self::Success>>>;
4343
}
4444

src/class/mapping.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
//! Python Mapping Interface
44
//! Trait and support implementation for implementing mapping support
55
6-
use callback::{LenResultConverter, PyObjectCallbackConverter};
7-
use class::methods::PyMethodDef;
8-
use conversion::{FromPyObject, IntoPyObject};
9-
use err::{PyErr, PyResult};
10-
use ffi;
11-
use python::Python;
12-
use typeob::PyTypeInfo;
13-
use types::exceptions;
6+
use crate::callback::{LenResultConverter, PyObjectCallbackConverter};
7+
use crate::class::methods::PyMethodDef;
8+
use crate::conversion::{FromPyObject, IntoPyObject};
9+
use crate::err::{PyErr, PyResult};
10+
use crate::ffi;
11+
use crate::python::Python;
12+
use crate::typeob::PyTypeInfo;
13+
use crate::types::exceptions;
1414

1515
/// Mapping interface
1616
#[allow(unused_variables)]

src/class/methods.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) 2017-present PyO3 Project and Contributors
22

3-
use ffi;
3+
use crate::ffi;
44
use libc::c_int;
55
use std;
66
use std::ffi::CString;

src/class/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#[macro_use]
66
mod macros;
77

8-
pub mod async;
8+
pub mod pyasync;
99
pub mod basic;
1010
pub mod buffer;
1111
pub mod context;
@@ -17,7 +17,7 @@ pub mod methods;
1717
pub mod number;
1818
pub mod sequence;
1919

20-
pub use self::async::PyAsyncProtocol;
20+
pub use self::pyasync::PyAsyncProtocol;
2121
pub use self::basic::PyObjectProtocol;
2222
pub use self::buffer::PyBufferProtocol;
2323
pub use self::context::PyContextProtocol;
@@ -30,7 +30,7 @@ pub use self::sequence::PySequenceProtocol;
3030
pub use self::gc::{PyGCProtocol, PyTraverseError, PyVisit};
3131
pub use self::methods::{PyGetterDef, PyMethodDef, PyMethodDefType, PyMethodType, PySetterDef};
3232

33-
use ffi;
33+
use crate::ffi;
3434

3535
/// Operators for the __richcmp__ method
3636
#[derive(Debug)]

src/class/number.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
//! Python Number Interface
44
//! Trait and support implementation for implementing number protocol
55
6-
use callback::PyObjectCallbackConverter;
7-
use class::basic::PyObjectProtocolImpl;
8-
use class::methods::PyMethodDef;
9-
use err::PyResult;
10-
use ffi;
11-
use typeob::PyTypeInfo;
12-
use {FromPyObject, IntoPyObject};
6+
use crate::callback::PyObjectCallbackConverter;
7+
use crate::class::basic::PyObjectProtocolImpl;
8+
use crate::class::methods::PyMethodDef;
9+
use crate::err::PyResult;
10+
use crate::ffi;
11+
use crate::typeob::PyTypeInfo;
12+
use crate::{FromPyObject, IntoPyObject};
1313

1414
/// Number interface
1515
#[allow(unused_variables)]

src/class/async.rs renamed to src/class/pyasync.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
//! [PEP-0492](https://www.python.org/dev/peps/pep-0492/)
99
//!
1010
11-
use callback::PyObjectCallbackConverter;
12-
use class::methods::PyMethodDef;
13-
use err::PyResult;
14-
use ffi;
15-
use typeob::PyTypeInfo;
11+
use crate::callback::PyObjectCallbackConverter;
12+
use crate::class::methods::PyMethodDef;
13+
use crate::err::PyResult;
14+
use crate::ffi;
15+
use crate::typeob::PyTypeInfo;
1616

1717
/// Python Async/Await support interface.
1818
///
@@ -61,30 +61,30 @@ pub trait PyAsyncProtocol<'p>: PyTypeInfo {
6161
}
6262

6363
pub trait PyAsyncAwaitProtocol<'p>: PyAsyncProtocol<'p> {
64-
type Success: ::IntoPyObject;
64+
type Success: crate::IntoPyObject;
6565
type Result: Into<PyResult<Self::Success>>;
6666
}
6767

6868
pub trait PyAsyncAiterProtocol<'p>: PyAsyncProtocol<'p> {
69-
type Success: ::IntoPyObject;
69+
type Success: crate::IntoPyObject;
7070
type Result: Into<PyResult<Self::Success>>;
7171
}
7272

7373
pub trait PyAsyncAnextProtocol<'p>: PyAsyncProtocol<'p> {
74-
type Success: ::IntoPyObject;
74+
type Success: crate::IntoPyObject;
7575
type Result: Into<PyResult<Option<Self::Success>>>;
7676
}
7777

7878
pub trait PyAsyncAenterProtocol<'p>: PyAsyncProtocol<'p> {
79-
type Success: ::IntoPyObject;
79+
type Success: crate::IntoPyObject;
8080
type Result: Into<PyResult<Self::Success>>;
8181
}
8282

8383
pub trait PyAsyncAexitProtocol<'p>: PyAsyncProtocol<'p> {
84-
type ExcType: ::FromPyObject<'p>;
85-
type ExcValue: ::FromPyObject<'p>;
86-
type Traceback: ::FromPyObject<'p>;
87-
type Success: ::IntoPyObject;
84+
type ExcType: crate::FromPyObject<'p>;
85+
type ExcValue: crate::FromPyObject<'p>;
86+
type Traceback: crate::FromPyObject<'p>;
87+
type Success: crate::IntoPyObject;
8888
type Result: Into<PyResult<Self::Success>>;
8989
}
9090

@@ -189,10 +189,10 @@ impl<'p, T> PyAsyncAnextProtocolImpl for T where T: PyAsyncProtocol<'p> {}
189189
#[cfg(Py_3)]
190190
mod anext {
191191
use super::{PyAsyncAnextProtocol, PyAsyncAnextProtocolImpl};
192-
use callback::CallbackConverter;
193-
use conversion::IntoPyObject;
194-
use ffi;
195-
use python::{IntoPyPointer, Python};
192+
use crate::callback::CallbackConverter;
193+
use crate::conversion::IntoPyObject;
194+
use crate::ffi;
195+
use crate::python::{IntoPyPointer, Python};
196196
use std::ptr;
197197

198198
pub struct IterANextResultConverter;

0 commit comments

Comments
 (0)