various: fix clippy lints

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Icbd2ba104c66907208cb37adf0c3915a6a6a6964
This commit is contained in:
raf 2026-03-25 17:08:06 +03:00
commit 0c294d348b
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
2 changed files with 7 additions and 5 deletions

View file

@ -99,12 +99,14 @@ fn print_system_info(
{blue} {cyan} {cyan} {blue}Colors{reset} {colors}\n\n"
)?;
let len = cursor.position() as usize;
let len =
usize::try_from(cursor.position()).expect("cursor position fits usize");
// Direct syscall to avoid stdout buffering allocation
let written = unsafe { syscall::sys_write(1, buf.as_ptr(), len) };
if written < 0 {
return Err(io::Error::last_os_error().into());
}
#[allow(clippy::cast_sign_loss)] // non-negative verified by the guard above
if written as usize != len {
return Err(
io::Error::new(io::ErrorKind::WriteZero, "partial write to stdout")