fix some lints caught by Clippy

Most of these changes are very simple. Among the changes made involve
taking advantage of auto-deref (`(*val).foo()` -> `val.foo()`) and
removing instances where we create a ref and immediately dereference it
(`&*val` -> `val`). There was a pretty neat case in `posix_openpt` where
some pointer verbosity was able to be reduced by using the more modern C
strings rather than the byte strings with an explicit NUL at the end.

Additionally, `exit()` now calls `unreachable!()` at the end. We
previously did `loop {}`, but clippy didn't like this. It can be up for
debate whether we want to make this `unreachable_unchecked` or similar.

There is only one change that might cause any sort of concern, and that
is the change from `.skip_while(!p).next()` -> `.find(p)`. This, like
everything else, was caught in a Clippy lint but I believe it deserves
some explanation because it isn't immediately obvious. Info about the
lint is here: https://rust-lang.github.io/rust-clippy/rust-1.89.0/index.html#skip_while_next
This commit is contained in:
Connor-GH
2026-04-30 19:02:35 -05:00
parent c1912066a1
commit 7c8259dfd6
11 changed files with 14 additions and 15 deletions
+2 -2
View File
@@ -920,10 +920,10 @@ pub unsafe extern "C" fn posix_memalign(
#[unsafe(no_mangle)]
pub unsafe extern "C" fn posix_openpt(flags: c_int) -> c_int {
#[cfg(target_os = "redox")]
let r = unsafe { open((b"/scheme/pty\0" as *const u8).cast(), O_CREAT) };
let r = unsafe { open(c"/scheme/pty".as_ptr(), O_CREAT) };
#[cfg(target_os = "linux")]
let r = unsafe { open((b"/dev/ptmx\0" as *const u8).cast(), flags) };
let r = unsafe { open(c"/dev/ptmx".as_ptr(), flags) };
if r < 0 && platform::ERRNO.get() == ENOSPC {
platform::ERRNO.set(EAGAIN);