From 251c9632346b030f3a186ed0bef5ce0719261585 Mon Sep 17 00:00:00 2001 From: MarcusGrass Date: Fri, 25 Aug 2023 20:23:03 +0200 Subject: [PATCH] Format, lint --- Cargo.toml | 1 + tiny-std/src/allocator/dlmalloc.rs | 4 ++-- tiny-std/src/io/read_buf.rs | 2 +- tiny-std/src/process.rs | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2e76ac2..2cb0c97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,4 @@ [workspace] +resolver = "2" members = ["rusl", "tiny-std"] exclude = ["test-runners/alloc-st-main", "test-runners/no-alloc-main", "test-runners/threaded-main", "test-runners/test-lib"] \ No newline at end of file diff --git a/tiny-std/src/allocator/dlmalloc.rs b/tiny-std/src/allocator/dlmalloc.rs index 99e4929..f62ff8a 100644 --- a/tiny-std/src/allocator/dlmalloc.rs +++ b/tiny-std/src/allocator/dlmalloc.rs @@ -997,7 +997,7 @@ impl Dlmalloc { unsafe fn segment_holding(&self, ptr: *mut u8) -> *mut Segment { let sp = ptr::addr_of!(self.seg); - let mut sp = sp as *mut Segment; + let mut sp = sp.cast_mut(); while !sp.is_null() { if (*sp).base <= ptr && ptr < Segment::top(sp) { return sp; @@ -1463,7 +1463,7 @@ impl Dlmalloc { unsafe fn has_segment_link(&self, ptr: *mut Segment) -> bool { let sp = ptr::addr_of!(self.seg); - let mut sp = sp as *mut Segment; + let mut sp = sp.cast_mut(); while !sp.is_null() { if Segment::holds(ptr, sp.cast::()) { return true; diff --git a/tiny-std/src/io/read_buf.rs b/tiny-std/src/io/read_buf.rs index cb027e0..cbfe091 100644 --- a/tiny-std/src/io/read_buf.rs +++ b/tiny-std/src/io/read_buf.rs @@ -130,7 +130,7 @@ impl<'a> ReadBuf<'a> { let uninit = n - extra_init; let unfilled = &mut self.uninitialized_mut()[0..uninit]; - for byte in unfilled.iter_mut() { + for byte in &mut *unfilled { byte.write(0); } diff --git a/tiny-std/src/process.rs b/tiny-std/src/process.rs index c14203e..401f72b 100644 --- a/tiny-std/src/process.rs +++ b/tiny-std/src/process.rs @@ -431,9 +431,9 @@ pub unsafe fn do_exec( } } let Err(e) = rusl::process::execve(bin, argv, envp) else { - // execve only returns on error. - unreachable_unchecked(); - }; + // execve only returns on error. + unreachable_unchecked(); + }; e.into() }