Skip to content

Commit

Permalink
📝 fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Xudong-Huang committed Jun 10, 2021
1 parent adfeab7 commit cd677f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/stack/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,9 @@ pub fn max_stack_size() -> usize {
let mut ret = PAGE_SIZE.load(Ordering::Relaxed);

if ret == 0 {
let mut limit;
let limitret;

unsafe {
limit = mem::MaybeUninit::uninit().assume_init();
limitret = libc::getrlimit(libc::RLIMIT_STACK, &mut limit);
}
let limit = mem::MaybeUninit::uninit();
let mut limit = unsafe { limit.assume_init() };
let limitret = unsafe { libc::getrlimit(libc::RLIMIT_STACK, &mut limit) };

if limitret == 0 {
ret = if limit.rlim_max == libc::RLIM_INFINITY
Expand Down
5 changes: 4 additions & 1 deletion src/yield_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ pub fn done<T>() -> T {
assert!(is_generator(), "done is only possible in a generator");
// set the done bit for this special return
ContextStack::current().top()._ref = 0xf;
unsafe { std::mem::MaybeUninit::uninit().assume_init() }
// this return value would not be dropped when _ref is 0xf
// so it's safe here to reutrn a dummy T
let ret = std::mem::MaybeUninit::uninit();
unsafe { ret.assume_init() }
}

/// switch back to parent context
Expand Down

0 comments on commit cd677f7

Please sign in to comment.