mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Fix unused imports for android (#6106)
This commit is contained in:
1 parent
e3e0e8a364
commit
5c6f92d497
1 file changed
+6
-4
@@ -5,14 +5,16 @@ pub(crate) use pwd::make_module;
|
||||
#[pymodule]
|
||||
mod pwd {
|
||||
use crate::{
|
||||
PyObjectRef, PyResult, VirtualMachine,
|
||||
PyResult, VirtualMachine,
|
||||
builtins::{PyIntRef, PyUtf8StrRef},
|
||||
convert::{IntoPyException, ToPyObject},
|
||||
convert::IntoPyException,
|
||||
exceptions,
|
||||
types::PyStructSequence,
|
||||
};
|
||||
use nix::unistd::{self, User};
|
||||
use std::ptr::NonNull;
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
use crate::{PyObjectRef, convert::ToPyObject};
|
||||
|
||||
#[pyattr]
|
||||
#[pyclass(module = "pwd", name = "struct_passwd")]
|
||||
@@ -101,7 +103,7 @@ mod pwd {
|
||||
let mut list = Vec::new();
|
||||
|
||||
unsafe { libc::setpwent() };
|
||||
while let Some(ptr) = NonNull::new(unsafe { libc::getpwent() }) {
|
||||
while let Some(ptr) = std::ptr::NonNull::new(unsafe { libc::getpwent() }) {
|
||||
let user = User::from(unsafe { ptr.as_ref() });
|
||||
let passwd = Passwd::from(user).to_pyobject(vm);
|
||||
list.push(passwd);
|
||||
|
||||
Reference in new issue
Block a user