bolts: haiku, addressing clippy warnings (#1647)

This commit is contained in:
David CARLIER 2023-11-04 16:03:09 +00:00 committed by GitHub
parent 56b37bb4bd
commit bae24d9072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 11 deletions

View File

@ -350,12 +350,14 @@ mod linux {
// FIXME: no sense of cpu granularity (yet ?)
#[cfg(target_os = "haiku")]
#[allow(clippy::unnecessary_wraps)]
#[inline]
fn get_core_ids_helper() -> Result<Vec<CoreId>, Error> {
Ok(Vec::new())
}
#[cfg(target_os = "haiku")]
#[allow(clippy::unnecessary_wraps)]
#[inline]
fn set_for_current_helper(_core_id: CoreId) -> Result<(), Error> {
Ok(())

View File

@ -653,7 +653,7 @@ fn write_crash<W: Write>(
_ucontext: &ucontext_t,
) -> Result<(), std::io::Error> {
// TODO add fault addr for other platforms.
writeln!(writer, "Received signal {}", signal,)?;
writeln!(writer, "Received signal {signal}")?;
Ok(())
}
@ -848,15 +848,16 @@ fn write_minibsod<W: Write>(writer: &mut BufWriter<W>) -> Result<(), std::io::Er
#[cfg(target_os = "haiku")]
fn write_minibsod<W: Write>(writer: &mut BufWriter<W>) -> Result<(), std::io::Error> {
let mut info: libc::image_info = unsafe { std::mem::zeroed() };
let p = std::mem::MaybeUninit::<libc::image_info>::uninit();
let mut info = unsafe { p.assume_init() };
let mut c: i32 = 0;
loop {
if unsafe { libc::get_next_image_info(0, &mut c, &mut info) } == libc::B_OK {
let i = format!(
"{}-{} {:?}\n",
info.text as u64,
info.text as u64 + info.text_size as u64,
info.text as i64,
info.text as i64 + i64::from(info.text_size),
info.name
);
writer.write_all(&i.into_bytes())?;

View File

@ -10,9 +10,9 @@ use core::fmt::Display;
use core::{cell::RefCell, fmt, mem::ManuallyDrop};
#[cfg(feature = "std")]
use std::env;
#[cfg(all(unix, feature = "std"))]
#[cfg(all(unix, feature = "std", not(target_os = "haiku")))]
use std::io::Read;
#[cfg(feature = "std")]
#[cfg(all(feature = "std", not(target_os = "haiku")))]
use std::io::Write;
use serde::{Deserialize, Serialize};
@ -27,7 +27,7 @@ pub use unix_shmem::{UnixShMem, UnixShMemProvider};
#[cfg(all(windows, feature = "std"))]
pub use win32_shmem::{Win32ShMem, Win32ShMemProvider};
#[cfg(all(unix, feature = "std"))]
#[cfg(all(unix, feature = "std", not(target_os = "haiku")))]
use crate::os::pipes::Pipe;
#[cfg(all(feature = "std", unix, not(target_os = "haiku")))]
pub use crate::os::unix_shmem_server::{ServedShMemProvider, ShMemService};
@ -411,7 +411,7 @@ impl<T: ShMemProvider> Drop for RcShMem<T> {
/// that can use internal mutability.
/// Useful if the `ShMemProvider` needs to keep local state.
#[derive(Debug, Clone)]
#[cfg(all(unix, feature = "std"))]
#[cfg(all(unix, feature = "std", not(target_os = "haiku")))]
pub struct RcShMemProvider<SP>
where
SP: ShMemProvider,
@ -505,7 +505,7 @@ where
}
}
#[cfg(all(unix, feature = "std"))]
#[cfg(all(unix, feature = "std", not(target_os = "haiku")))]
impl<SP> RcShMemProvider<SP>
where
SP: ShMemProvider,
@ -1457,7 +1457,7 @@ pub struct ShMemCursor<T: ShMem> {
pos: usize,
}
#[cfg(feature = "std")]
#[cfg(all(feature = "std", not(target_os = "haiku")))]
impl<T: ShMem> ShMemCursor<T> {
/// Create a new [`ShMemCursor`] around [`ShMem`]
pub fn new(shmem: T) -> Self {
@ -1473,7 +1473,7 @@ impl<T: ShMem> ShMemCursor<T> {
}
}
#[cfg(feature = "std")]
#[cfg(all(feature = "std", not(target_os = "haiku")))]
impl<T: ShMem> Write for ShMemCursor<T> {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
match self.empty_slice_mut().write(buf) {