add upper_case_acronyms clippy lint and minor cleanups
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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(),
|
||||
);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -11,7 +11,7 @@ pub fn is(wc: usize) -> c_uchar {
|
||||
if wc < 0x2fffe {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
0
|
||||
}
|
||||
|
||||
const table: [c_uchar; 3904] = [
|
||||
|
||||
@@ -410,5 +410,5 @@ pub fn casemap(mut c: u32, dir: i32) -> wint_t {
|
||||
xn -= xn / 2;
|
||||
}
|
||||
}
|
||||
return c0;
|
||||
c0
|
||||
}
|
||||
|
||||
@@ -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
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user