Skip to content

Commit ae38389

Browse files
authored
Merge pull request #3153 from youknowone/use-statement
clean up use statements
2 parents da898a3 + 732c7d2 commit ae38389

4 files changed

Lines changed: 22 additions & 20 deletions

File tree

vm/src/stdlib/posixsubprocess.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
use crate::{
2+
stdlib::{os::PyPathLike, posix},
3+
{PyObjectRef, PyResult, PySequence, TryFromObject, VirtualMachine},
4+
};
5+
use nix::{errno::Errno, unistd};
6+
#[cfg(not(target_os = "redox"))]
7+
use std::ffi::CStr;
8+
#[cfg(not(target_os = "redox"))]
9+
use std::os::unix::io::AsRawFd;
10+
use std::{
11+
convert::Infallible as Never,
12+
ffi::CString,
13+
io::{self, prelude::*},
14+
};
15+
116
pub(crate) use _posixsubprocess::make_module;
217

318
#[pymodule]
@@ -28,18 +43,6 @@ mod _posixsubprocess {
2843
}
2944
}
3045

31-
use super::os::PyPathLike;
32-
use super::posix;
33-
use crate::{PyObjectRef, PyResult, PySequence, TryFromObject, VirtualMachine};
34-
use nix::{errno::Errno, unistd};
35-
use std::convert::Infallible as Never;
36-
#[cfg(not(target_os = "redox"))]
37-
use std::ffi::CStr;
38-
use std::ffi::CString;
39-
use std::io::{self, prelude::*};
40-
#[cfg(not(target_os = "redox"))]
41-
use std::os::unix::io::AsRawFd;
42-
4346
macro_rules! gen_args {
4447
($($field:ident: $t:ty),*$(,)?) => {
4548
#[derive(FromArgs)]

vm/src/stdlib/pyexpat.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ macro_rules! create_property {
3131

3232
#[pymodule(name = "pyexpat")]
3333
mod _pyexpat {
34-
use crate::builtins::{PyStr, PyStrRef, PyTypeRef};
35-
use crate::byteslike::ArgBytesLike;
36-
use crate::function::{IntoFuncArgs, OptionalArg};
3734
use crate::{
35+
builtins::{PyStr, PyStrRef, PyTypeRef},
36+
byteslike::ArgBytesLike,
37+
function::{IntoFuncArgs, OptionalArg},
3838
ItemProtocol, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
3939
VirtualMachine,
4040
};

vm/src/stdlib/select.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,10 @@ fn sec_to_timeval(sec: f64) -> timeval {
148148

149149
#[pymodule(name = "select")]
150150
mod decl {
151-
use super::super::time;
152151
use super::*;
153152
use crate::{
154-
exceptions::IntoPyException, function::OptionalOption, utils::Either, PyObjectRef,
155-
PyResult, VirtualMachine,
153+
exceptions::IntoPyException, function::OptionalOption, stdlib::time, utils::Either,
154+
PyObjectRef, PyResult, VirtualMachine,
156155
};
157156

158157
#[pyfunction]

vm/src/stdlib/ssl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::common::lock::{PyRwLock, PyRwLockWriteGuard};
33
use crate::{
44
builtins::{PyStrRef, PyType, PyTypeRef, PyWeak},
55
byteslike::{ArgBytesLike, ArgMemoryBuffer, ArgStrOrBytesLike},
6-
exceptions::{create_exception_type, IntoPyException, PyBaseExceptionRef},
6+
exceptions::{self, create_exception_type, IntoPyException, PyBaseExceptionRef},
77
function::{ArgCallable, OptionalArg},
88
slots::SlotConstructor,
99
stdlib::os::PyPathLike,
@@ -343,7 +343,7 @@ impl PySslContext {
343343
fn set_ciphers(&self, cipherlist: PyStrRef, vm: &VirtualMachine) -> PyResult<()> {
344344
let ciphers = cipherlist.as_str();
345345
if ciphers.contains('\0') {
346-
return Err(crate::exceptions::cstring_error(vm));
346+
return Err(exceptions::cstring_error(vm));
347347
}
348348
self.builder().set_cipher_list(ciphers).map_err(|_| {
349349
vm.new_exception_msg(ssl_error(vm), "No cipher can be selected.".to_owned())

0 commit comments

Comments
 (0)