add unused_imports lint

This commit is contained in:
auronandace
2026-02-10 15:55:32 +00:00
parent 8c81e34ab8
commit 7d1582a555
32 changed files with 41 additions and 79 deletions
+1
View File
@@ -37,6 +37,7 @@ non_snake_case = "allow"
non_upper_case_globals = "allow"
unpredictable_function_pointer_comparisons = "deny"
unsafe_op_in_unsafe_fn = "deny"
unused_imports = "deny"
unused_mut = "deny"
unused_unsafe = "deny"
unused_variables = "allow" # TODO review occurrences (too many for now)
+2 -5
View File
@@ -2,12 +2,9 @@
use core::{marker::PhantomData, ptr::NonNull, str::Utf8Error};
use alloc::{
borrow::{Cow, ToOwned},
string::String,
};
use alloc::{borrow::Cow, string::String};
use crate::platform::types::{c_char, c_int, wchar_t};
use crate::platform::types::{c_char, wchar_t};
mod private {
pub trait Sealed {}
+2 -2
View File
@@ -1,6 +1,6 @@
use crate::platform::types::*;
use crate::platform::types::{c_int, c_void};
use alloc::vec::Vec;
use core::{cell::RefCell, ptr};
use core::cell::RefCell;
use spin::Mutex;
#[derive(Clone, Copy)]
-2
View File
@@ -2,8 +2,6 @@
//!
//! Non-POSIX, see <https://www.man7.org/linux/man-pages/man3/getifaddrs.3.html>.
use core::ptr;
use crate::{
header::{errno, stdlib, sys_socket::sockaddr},
platform::{
+1 -6
View File
@@ -1,11 +1,6 @@
use core::str::FromStr;
use alloc::{
boxed::Box,
ffi::CString,
string::{String, ToString},
vec::Vec,
};
use alloc::{boxed::Box, ffi::CString, string::String, vec::Vec};
use super::constants::*;
use crate::platform::types::{c_char, c_int};
+1 -1
View File
@@ -5,7 +5,7 @@
use crate::{
header::errno::ENOMEM,
platform::{
self, ERRNO, Pal, Sys,
self, Pal, Sys,
types::{c_void, size_t},
},
};
+2 -2
View File
@@ -6,9 +6,9 @@
// according to the current locale (TODO).
use alloc::string::{String, ToString};
use core::{ffi::CStr, ptr, slice, str};
use core::str;
use libm::{fabs, floor, pow, round, trunc};
use libm::{fabs, pow, round, trunc};
extern crate alloc;
+2 -2
View File
@@ -2,8 +2,8 @@ use crate::platform::types::c_char;
use super::{DEFAULT_MONETARY, FormatFlags, LocaleMonetaryInfo, apply_grouping};
use alloc::string::{String, ToString};
use core::{ffi::CStr, ptr, result, slice, str};
use libm::{fabs, floor, pow, round, trunc};
use core::{ffi::CStr, slice};
use libm::{fabs, pow, round, trunc};
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strfmon.html>.
///
-1
View File
@@ -2,7 +2,6 @@ use alloc::{boxed::Box, str::SplitWhitespace, vec::Vec};
use core::{mem, ptr};
use crate::{
c_str::CString,
error::ResultExt,
header::{
arpa_inet::inet_aton, fcntl::O_RDONLY, netinet_in::in_addr, sys_socket::constants::AF_INET,
-1
View File
@@ -1,5 +1,4 @@
use crate::{
c_str::CString,
error::Errno,
fs::File,
header::{errno, fcntl},
+2 -9
View File
@@ -4,16 +4,9 @@
mod dns;
use core::{
cell::Cell,
fmt::Write,
mem,
net::Ipv4Addr,
ptr, slice,
str::{self, FromStr},
};
use core::{cell::Cell, fmt::Write, mem, net::Ipv4Addr, ptr, str};
use alloc::{borrow::ToOwned, boxed::Box, str::SplitWhitespace, string::ToString, vec::Vec};
use alloc::{boxed::Box, str::SplitWhitespace, string::ToString, vec::Vec};
use crate::{
c_str::{CStr, CString},
+1 -1
View File
@@ -1,4 +1,4 @@
use super::{siginfo_t, sigset_t, stack_t};
use super::{sigset_t, stack_t};
use crate::platform::types::c_ulong;
use core::arch::global_asm;
-1
View File
@@ -7,7 +7,6 @@ use core::{arch::global_asm, mem, ptr};
use cbitset::BitSet;
use crate::{
c_str::CStr,
error::{Errno, ResultExt},
header::{errno, setjmp, time::timespec},
platform::{
+4 -6
View File
@@ -1,22 +1,20 @@
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/getline.html
use alloc::{string::String, vec::Vec};
use core::{fmt::Write, intrinsics::unlikely, ops::Deref, ptr};
use alloc::vec::Vec;
use core::{intrinsics::unlikely, ptr};
use crate::{
header::{
errno::{EINVAL, ENOMEM, ENOSPC, EOVERFLOW},
stdio,
errno::{EINVAL, ENOMEM, EOVERFLOW},
stdio::FILE,
stdlib,
},
io::BufRead,
platform,
platform::types::{c_char, c_int, c_void, size_t, ssize_t},
};
use crate::{
header::stdio::{F_EOF, F_ERR, default_stdout, feof, ferror},
header::stdio::{F_EOF, F_ERR, feof, ferror},
platform::ERRNO,
};
-1
View File
@@ -6,7 +6,6 @@ use crate::{
error::ResultExt,
platform::{PalPtrace, Sys, types::c_int},
};
use core::ffi::VaList;
pub const PTRACE_TRACEME: c_int = 0;
pub const PTRACE_PEEKTEXT: c_int = 1;
+1 -1
View File
@@ -9,7 +9,7 @@ use crate::{
out::Out,
platform::{
Pal, PalSignal, Sys,
types::{c_char, c_int, c_long, suseconds_t, time_t},
types::{c_char, c_int, c_long},
},
};
use core::ptr::null;
+4 -6
View File
@@ -7,7 +7,6 @@ use crate::{
error::{Errno, ResultExt},
header::{
errno::{EFAULT, ENOMEM, EOVERFLOW, ETIMEDOUT},
fcntl::O_RDONLY,
signal::sigevent,
stdlib::getenv,
unistd::readlink,
@@ -16,16 +15,15 @@ use crate::{
platform::{
self, Pal, Sys,
types::{
c_char, c_double, c_int, c_long, c_ulong, clock_t, clockid_t, pid_t, pthread_t, size_t,
time_t, timer_t,
c_char, c_double, c_int, c_long, clock_t, clockid_t, pid_t, size_t, time_t, timer_t,
},
},
sync::{Mutex, MutexGuard},
};
use alloc::collections::BTreeSet;
use chrono::{
DateTime, Datelike, FixedOffset, NaiveDate, NaiveDateTime, Offset, ParseError, TimeZone,
Timelike, Utc, format::ParseErrorKind, offset::MappedLocalTime,
DateTime, Datelike, FixedOffset, NaiveDate, NaiveDateTime, Offset, TimeZone, Timelike, Utc,
offset::MappedLocalTime,
};
use chrono_tz::{OffsetComponents, OffsetName, Tz};
use core::{cell::OnceCell, convert::TryFrom, fmt::Debug, mem, ptr};
@@ -127,7 +125,7 @@ pub(crate) struct timer_internal_t {
pub timerfd: usize,
pub eventfd: usize,
pub evp: sigevent,
pub thread: pthread_t,
pub thread: platform::types::pthread_t,
pub caller_thread: crate::pthread::OsTid,
// relibc handles it_interval, not the kernel
pub next_wake_time: itimerspec,
+1 -1
View File
@@ -4,7 +4,7 @@
use alloc::string::String;
use super::{get_offset, tm};
use super::tm;
use crate::{
c_str::CStr,
platform::{
+1 -1
View File
@@ -2,7 +2,7 @@ use super::{FILE, SEEK_SET, fseek_locked, ftell_locked};
use crate::{
header::{
errno::EILSEQ,
wchar::{MB_CUR_MAX, fgetwc, get_char_encoded_length, mbrtowc},
wchar::{MB_CUR_MAX, get_char_encoded_length, mbrtowc},
wctype::WEOF,
},
io::Read,
+1 -1
View File
@@ -3,7 +3,7 @@ use crate::{
c_str::{self, WStr},
header::stdio::printf::inner_printf,
io::Write,
platform::{self, types::c_int},
platform::types::c_int,
};
use core::ffi::VaList;
+1 -1
View File
@@ -58,7 +58,7 @@ pub mod raw_cell;
pub mod start;
pub mod sync;
use crate::platform::{Allocator, NEWALLOCATOR, Pal, Sys};
use crate::platform::{Allocator, NEWALLOCATOR};
#[global_allocator]
static ALLOCATOR: Allocator = NEWALLOCATOR;
+2 -2
View File
@@ -1,9 +1,9 @@
use crate::{
header::{
sys_mman::{self, MAP_FAILED, MREMAP_MAYMOVE},
sys_mman::{self, MREMAP_MAYMOVE},
unistd::pthread_atfork,
},
platform::{Pal, Sys, types::*},
platform::{Pal, Sys},
sync::Mutex,
};
use core::ptr;
+4 -5
View File
@@ -1,12 +1,12 @@
use core::{arch::asm, num::NonZeroU64, ptr};
use super::{ERRNO, Pal, types::*};
use super::{Pal, types::*};
use crate::{
c_str::CStr,
header::{
dirent::dirent,
errno::{EINVAL, EIO, EOPNOTSUPP},
fcntl::{AT_EMPTY_PATH, AT_FDCWD, AT_REMOVEDIR, AT_SYMLINK_NOFOLLOW},
errno::{EINVAL, EIO},
fcntl::{AT_EMPTY_PATH, AT_FDCWD, AT_REMOVEDIR},
signal::{SIGCHLD, sigevent},
sys_resource::{rlimit, rusage},
sys_select::timeval,
@@ -16,7 +16,6 @@ use crate::{
time::itimerspec,
unistd::{SEEK_CUR, SEEK_SET},
},
io::Write,
ld_so::tcb::OsSpecific,
out::Out,
};
@@ -480,7 +479,7 @@ impl Pal for Sys {
path.as_ptr(),
owner as u32,
group as u32,
AT_SYMLINK_NOFOLLOW
crate::header::fcntl::AT_SYMLINK_NOFOLLOW
)
})
.map(|_| ())
+1 -1
View File
@@ -8,7 +8,7 @@ use super::{
use crate::{
error::{Errno, Result},
header::{
signal::{NSIG, SA_RESTORER, SI_QUEUE, sigaction, siginfo_t, sigset_t, stack_t},
signal::{SA_RESTORER, SI_QUEUE, sigaction, siginfo_t, sigset_t, stack_t},
sys_time::itimerval,
time::timespec,
},
+1 -9
View File
@@ -1,12 +1,6 @@
use core::{fmt, str::FromStr};
use crate::{
c_str::CStr,
fs::{self, File},
header::fcntl,
io::{self, BufWriter, prelude::*},
sync::Mutex,
};
use crate::{c_str::CStr, io::prelude::*, sync::Mutex};
use alloc::string::String;
use log::{Metadata, Record};
@@ -243,8 +237,6 @@ impl RedoxLogger {
process_name: Option<&str>,
writer: &mut W,
) -> fmt::Result {
use log::Level;
let target = record.module_path().unwrap_or(record.target());
let level = record.level();
let message = record.args();
+2 -2
View File
@@ -1,7 +1,7 @@
use crate::{
error::{Errno, Result},
error::Result,
header::{signal::sigset_t, sys_epoll::epoll_event},
platform::{Pal, types::*},
platform::{Pal, types::c_int},
};
pub trait PalEpoll: Pal {
+1 -1
View File
@@ -80,7 +80,7 @@ pub type clock_t = c_long;
pub type clockid_t = c_int;
pub type timer_t = *mut c_void;
pub use crate::header::{bits_pthread::*, bits_sched::*};
pub use crate::header::bits_pthread::*;
#[repr(C, align(16))]
pub struct max_align_t {
+1 -2
View File
@@ -2,8 +2,7 @@
use core::{
cell::UnsafeCell,
mem::MaybeUninit,
ptr::{self, addr_of},
ptr,
sync::atomic::{AtomicBool, AtomicUsize, Ordering},
};
+1 -1
View File
@@ -3,7 +3,7 @@
use crate::{
error::Errno,
header::{
errno::{EINVAL, ENOMEM, ETIMEDOUT},
errno::{EINVAL, ETIMEDOUT},
pthread::*,
time::{CLOCK_MONOTONIC, CLOCK_REALTIME, timespec, timespec_realtime_to_monotonic},
},
+1 -2
View File
@@ -6,10 +6,9 @@ use core::{
use crate::{
error::Errno,
header::{errno::*, pthread::*, time::timespec},
pthread::*,
};
use crate::platform::{Pal, Sys, types::*};
use crate::platform::{Pal, Sys, types::c_int};
use super::FutexWaitResult;
-1
View File
@@ -1,7 +1,6 @@
use core::{
cell::UnsafeCell,
fmt, ops,
ptr::NonNull,
sync::atomic::{AtomicU32, Ordering},
};
-2
View File
@@ -4,8 +4,6 @@ use core::{
sync::atomic::{AtomicU32 as AtomicUint, Ordering},
};
use super::*;
/// An unsafe "one thread to one thread" synchronization primitive. Used for and modeled after
/// pthread_join only, at the moment.
#[derive(Debug)]