Skip to content

Commit 6bcf4fd

Browse files
committed
Resolve std warnings on VEXos
1 parent 8dc1876 commit 6bcf4fd

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

library/std/src/sys/fs/vexos.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::ffi::{CString, OsString};
1+
use crate::ffi::OsString;
22
use crate::fmt;
33
use crate::fs::TryLockError;
44
use crate::hash::Hash;
@@ -277,7 +277,7 @@ impl File {
277277
}
278278

279279
if *truncate {
280-
unsafe { vex_sdk::vexFileOpenCreate(path.as_ptr()) }
280+
vex_sdk::vexFileOpenCreate(path.as_ptr())
281281
} else {
282282
// Open in append, but jump to the start of the file.
283283
let fd = vex_sdk::vexFileOpenWrite(path.as_ptr());

library/std/src/sys/pal/vexos/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub mod thread;
66
pub mod time;
77

88
use crate::arch::global_asm;
9-
use crate::ptr::{self, addr_of_mut};
9+
use crate::ptr;
1010
use crate::sys::stdio;
1111
use crate::time::{Duration, Instant};
1212

library/std/src/sys/pal/vexos/thread.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use super::unsupported;
22
use crate::ffi::CStr;
33
use crate::io;
4-
use crate::num::NonZero;
54
use crate::time::{Duration, Instant};
65

76
#[expect(dead_code)]

library/std/src/sys/stdio/vexos.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,13 @@ impl io::Write for Stdout {
5454
self.flush().unwrap();
5555
}
5656

57-
let count = unsafe {
57+
let count: usize = unsafe {
5858
vex_sdk::vexSerialWriteBuffer(STDIO_CHANNEL, chunk.as_ptr(), chunk.len() as u32)
59-
} as usize;
60-
61-
if count < 0 {
62-
return Err(io::Error::new(
63-
io::ErrorKind::Uncategorized,
64-
"Internal write error occurred.",
65-
));
6659
}
60+
.try_into()
61+
.map_err(|_| {
62+
io::Error::new(io::ErrorKind::Uncategorized, "Internal write error occurred.")
63+
})?;
6764

6865
written += count;
6966

0 commit comments

Comments
 (0)