From 732c7d201d2740d7ef9de92c7b58ac5eb9a35020 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Tue, 28 Sep 2021 02:56:07 +0900 Subject: [PATCH] clean up use statements --- vm/src/stdlib/posixsubprocess.rs | 27 +++++++++++++++------------ vm/src/stdlib/pyexpat.rs | 6 +++--- vm/src/stdlib/select.rs | 5 ++--- vm/src/stdlib/ssl.rs | 4 ++-- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/vm/src/stdlib/posixsubprocess.rs b/vm/src/stdlib/posixsubprocess.rs index be137eb2f..4409be579 100644 --- a/vm/src/stdlib/posixsubprocess.rs +++ b/vm/src/stdlib/posixsubprocess.rs @@ -1,3 +1,18 @@ +use crate::{ + stdlib::{os::PyPathLike, posix}, + {PyObjectRef, PyResult, PySequence, TryFromObject, VirtualMachine}, +}; +use nix::{errno::Errno, unistd}; +#[cfg(not(target_os = "redox"))] +use std::ffi::CStr; +#[cfg(not(target_os = "redox"))] +use std::os::unix::io::AsRawFd; +use std::{ + convert::Infallible as Never, + ffi::CString, + io::{self, prelude::*}, +}; + pub(crate) use _posixsubprocess::make_module; #[pymodule] @@ -28,18 +43,6 @@ mod _posixsubprocess { } } -use super::os::PyPathLike; -use super::posix; -use crate::{PyObjectRef, PyResult, PySequence, TryFromObject, VirtualMachine}; -use nix::{errno::Errno, unistd}; -use std::convert::Infallible as Never; -#[cfg(not(target_os = "redox"))] -use std::ffi::CStr; -use std::ffi::CString; -use std::io::{self, prelude::*}; -#[cfg(not(target_os = "redox"))] -use std::os::unix::io::AsRawFd; - macro_rules! gen_args { ($($field:ident: $t:ty),*$(,)?) => { #[derive(FromArgs)] diff --git a/vm/src/stdlib/pyexpat.rs b/vm/src/stdlib/pyexpat.rs index c9fbcc01d..1d7f26b2a 100644 --- a/vm/src/stdlib/pyexpat.rs +++ b/vm/src/stdlib/pyexpat.rs @@ -31,10 +31,10 @@ macro_rules! create_property { #[pymodule(name = "pyexpat")] mod _pyexpat { - use crate::builtins::{PyStr, PyStrRef, PyTypeRef}; - use crate::byteslike::ArgBytesLike; - use crate::function::{IntoFuncArgs, OptionalArg}; use crate::{ + builtins::{PyStr, PyStrRef, PyTypeRef}, + byteslike::ArgBytesLike, + function::{IntoFuncArgs, OptionalArg}, ItemProtocol, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject, VirtualMachine, }; diff --git a/vm/src/stdlib/select.rs b/vm/src/stdlib/select.rs index 1fcf7f906..a0411ca04 100644 --- a/vm/src/stdlib/select.rs +++ b/vm/src/stdlib/select.rs @@ -148,11 +148,10 @@ fn sec_to_timeval(sec: f64) -> timeval { #[pymodule(name = "select")] mod decl { - use super::super::time; use super::*; use crate::{ - exceptions::IntoPyException, function::OptionalOption, utils::Either, PyObjectRef, - PyResult, VirtualMachine, + exceptions::IntoPyException, function::OptionalOption, stdlib::time, utils::Either, + PyObjectRef, PyResult, VirtualMachine, }; #[pyfunction] diff --git a/vm/src/stdlib/ssl.rs b/vm/src/stdlib/ssl.rs index ecef558d1..3da947ef4 100644 --- a/vm/src/stdlib/ssl.rs +++ b/vm/src/stdlib/ssl.rs @@ -3,7 +3,7 @@ use crate::common::lock::{PyRwLock, PyRwLockWriteGuard}; use crate::{ builtins::{PyStrRef, PyType, PyTypeRef, PyWeak}, byteslike::{ArgBytesLike, ArgMemoryBuffer, ArgStrOrBytesLike}, - exceptions::{create_exception_type, IntoPyException, PyBaseExceptionRef}, + exceptions::{self, create_exception_type, IntoPyException, PyBaseExceptionRef}, function::{ArgCallable, OptionalArg}, slots::SlotConstructor, stdlib::os::PyPathLike, @@ -343,7 +343,7 @@ impl PySslContext { fn set_ciphers(&self, cipherlist: PyStrRef, vm: &VirtualMachine) -> PyResult<()> { let ciphers = cipherlist.as_str(); if ciphers.contains('\0') { - return Err(crate::exceptions::cstring_error(vm)); + return Err(exceptions::cstring_error(vm)); } self.builder().set_cipher_list(ciphers).map_err(|_| { vm.new_exception_msg(ssl_error(vm), "No cipher can be selected.".to_owned())