fix a rust lint and a clippy lint

This commit is contained in:
auronandace
2026-03-10 12:11:03 +00:00
parent 9340d76a92
commit bd4fb1f660
2 changed files with 7 additions and 8 deletions
+3 -3
View File
@@ -951,7 +951,7 @@ pub(crate) unsafe fn inner_printf<T: c_str::Kind>(
varargs.get(index, &mut ap, Some((arg.fmtkind, arg.intkind)))
} {
VaArg::c_double(i) => i,
VaArg::c_longdouble(i) => unsafe { relibc_ldtod(&i as *const c_longdouble) },
VaArg::c_longdouble(i) => unsafe { relibc_ldtod(&raw const i) },
_ => panic!("this should not be possible"),
};
if float.is_finite() {
@@ -970,7 +970,7 @@ pub(crate) unsafe fn inner_printf<T: c_str::Kind>(
varargs.get(index, &mut ap, Some((arg.fmtkind, arg.intkind)))
} {
VaArg::c_double(i) => i,
VaArg::c_longdouble(i) => unsafe { relibc_ldtod(&i as *const c_longdouble) },
VaArg::c_longdouble(i) => unsafe { relibc_ldtod(&raw const i) },
_ => panic!("this should not be possible"),
};
if float.is_finite() {
@@ -986,7 +986,7 @@ pub(crate) unsafe fn inner_printf<T: c_str::Kind>(
varargs.get(index, &mut ap, Some((arg.fmtkind, arg.intkind)))
} {
VaArg::c_double(i) => i,
VaArg::c_longdouble(i) => unsafe { relibc_ldtod(&i as *const c_longdouble) },
VaArg::c_longdouble(i) => unsafe { relibc_ldtod(&raw const i) },
_ => panic!("this should not be possible"),
};
if float.is_finite() {
+4 -5
View File
@@ -429,10 +429,9 @@ unsafe fn deserialize_ancillary_data_from_stream(
let cmsg_data_from_stream = &msg_stream[*cursor..*cursor + cmsg_data_len_in_stream];
*cursor += cmsg_data_len_in_stream;
let mut actual_posix_cmsg_data_len: usize = 0;
let mut temp_posix_cmsg_data_buf: Vec<u8> = Vec::new();
match (cmsg_level, cmsg_type) {
let actual_posix_cmsg_data_len = match (cmsg_level, cmsg_type) {
(SOL_SOCKET, SCM_RIGHTS) => {
if cmsg_data_len_in_stream != mem::size_of::<usize>() {
return Err(Errno(EINVAL));
@@ -458,7 +457,7 @@ unsafe fn deserialize_ancillary_data_from_stream(
for fd in fds_usize {
temp_posix_cmsg_data_buf.extend_from_slice(&(fd as c_int).to_le_bytes());
}
actual_posix_cmsg_data_len = temp_posix_cmsg_data_buf.len();
temp_posix_cmsg_data_buf.len()
}
(SOL_SOCKET, SCM_CREDENTIALS) => {
if cmsg_data_len_in_stream
@@ -480,12 +479,12 @@ unsafe fn deserialize_ancillary_data_from_stream(
mem::size_of::<ucred>(),
)
});
actual_posix_cmsg_data_len = temp_posix_cmsg_data_buf.len();
temp_posix_cmsg_data_buf.len()
}
_ => {
return Err(Errno(EINVAL));
}
}
};
let space_needed_for_posix_cmsg =
unsafe { CMSG_SPACE(actual_posix_cmsg_data_len as u32) } as usize;