add upper_case_acronyms clippy lint and minor cleanups

This commit is contained in:
auronandace
2026-02-25 13:55:01 +00:00
parent ac9c4e6601
commit e1e9753c65
10 changed files with 13 additions and 13 deletions
+1
View File
@@ -28,6 +28,7 @@ precedence = "deny"
ptr_as_ptr = "warn" # TODO review occurrences
ptr_cast_constness = "warn" # TODO review occurrences
ref_as_ptr = "warn" # TODO review occurrences
upper_case_acronyms = "allow" # TODO review occurrences
zero_ptr = "warn" # must allow on public constants due to cbindgen issue
[workspace.lints.rust]
+1 -1
View File
@@ -19,7 +19,7 @@ pub unsafe extern "C" fn login_tty(fd: c_int) -> c_int {
sys_ioctl::ioctl(
fd,
sys_ioctl::TIOCSCTTY,
&mut arg as *mut c_int as *mut c_void,
core::ptr::from_mut::<c_int>(&mut arg).cast::<c_void>(),
)
} != 0
{
+1 -1
View File
@@ -88,7 +88,7 @@ impl<'a> LookAheadFile<'a> {
unsafe {
mbrtowc(
&mut wc,
buf.as_ptr() as *const c_char,
buf.as_ptr().cast::<c_char>(),
encoded_length,
ptr::null_mut(),
);
+1 -1
View File
@@ -2,7 +2,7 @@
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/wchar.h.html>.
use core::{char, ffi::VaList as va_list, mem, ptr, slice, usize};
use core::{char, ffi::VaList as va_list, mem, ptr, slice};
use crate::{
c_str::WStr,
+3 -3
View File
@@ -1,7 +1,7 @@
//UTF implementation parts for wchar.h.
//Partially ported from the Sortix libc
use core::{char, slice, str, usize};
use core::{char, slice, str};
use crate::{
header::errno,
@@ -55,7 +55,7 @@ pub unsafe fn mbrtowc(pwc: *mut wchar_t, s: *const c_char, n: usize, ps: *mut mb
return -1isize as usize;
}
let slice = unsafe { slice::from_raw_parts(s as *const u8, size) };
let slice = unsafe { slice::from_raw_parts(s.cast::<u8>(), size) };
let decoded = str::from_utf8(slice);
if decoded.is_err() {
platform::ERRNO.set(errno::EILSEQ);
@@ -84,7 +84,7 @@ pub unsafe fn wcrtomb(s: *mut c_char, wc: wchar_t, ps: *mut mbstate_t) -> usize
let c = dc.unwrap();
let size = c.len_utf8();
let slice = unsafe { slice::from_raw_parts_mut(s as *mut u8, size) };
let slice = unsafe { slice::from_raw_parts_mut(s.cast::<u8>(), size) };
c.encode_utf8(slice);
+1 -2
View File
@@ -475,8 +475,7 @@ unsafe fn inner_scanf(
// While we haven't used up all the width, and it matches
let mut data_stored = false;
while width.map(|w| w > 0).unwrap_or(true)
&& !invert == matches.contains(&wchar)
while width.map(|w| w > 0).unwrap_or(true) && invert != matches.contains(&wchar)
{
if let Some(ref mut ptr) = ptr {
unsafe { **ptr = wchar as c_char };
+1 -1
View File
@@ -11,7 +11,7 @@ pub fn is(wc: usize) -> c_uchar {
if wc < 0x2fffe {
return 1;
}
return 0;
0
}
const table: [c_uchar; 3904] = [
+1 -1
View File
@@ -410,5 +410,5 @@ pub fn casemap(mut c: u32, dir: i32) -> wint_t {
xn -= xn / 2;
}
}
return c0;
c0
}
+1 -1
View File
@@ -8,7 +8,7 @@ pub fn is(wc: usize) -> c_uchar {
if wc < 0x20000 {
return (table[(table[wc >> 8] as usize) * 32 + ((wc & 255) >> 3)] >> (wc & 7)) & 1;
}
return 0;
0
}
const table: [c_uchar; 4000] = [
+2 -2
View File
@@ -353,9 +353,9 @@ pub struct DSO {
}
impl DSO {
pub fn new<'a>(
pub fn new(
path: &str,
data: &'a [u8],
data: &[u8],
base_addr: Option<usize>,
dlopened: bool,
id: usize,