Skip to content

Commit

Permalink
📝 remove unnecessary allow meta
Browse files Browse the repository at this point in the history
  • Loading branch information
Xudong-Huang committed Apr 29, 2024
1 parent 233fa38 commit 25b25e6
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 30 deletions.
39 changes: 19 additions & 20 deletions benches/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,25 @@ use generator::*;
use test::Bencher;

// #[bench]
#[allow(dead_code)]
fn yield_bench(b: &mut Bencher) {
// don't print any panic info
// when cancel the generator
panic::set_hook(Box::new(|_| {}));

b.iter(|| {
let mut g = Gn::new(|| {
for i in 0.. {
yield_with(i);
}
20
});

for i in 0..1_000_000 {
let data = g.send(());
assert_eq!(data, i);
}
});
}
// fn yield_bench(b: &mut Bencher) {
// // don't print any panic info
// // when cancel the generator
// panic::set_hook(Box::new(|_| {}));

// b.iter(|| {
// let mut g = Gn::new(|| {
// for i in 0.. {
// yield_with(i);
// }
// 20
// });

// for i in 0..1_000_000 {
// let data = g.send(());
// assert_eq!(data, i);
// }
// });
// }

#[bench]
fn single_yield_with_bench(b: &mut Bencher) {
Expand Down
3 changes: 0 additions & 3 deletions src/detail/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::eq_op)]

// Register contexts used in various architectures
//
// These structures all represent a context of one task throughout its
Expand Down Expand Up @@ -44,7 +42,6 @@ fn align_down(sp: *mut usize) -> *mut usize {

// ptr::mut_offset is positive isize only
#[inline]
#[allow(unused)]
fn mut_offset<T>(ptr: *mut T, count: isize) -> *mut T {
// use std::mem::size_of;
// (ptr as isize + count * (size_of::<T>() as isize)) as *mut T
Expand Down
1 change: 0 additions & 1 deletion src/detail/x86_64_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ extern "sysv64" {
}

#[inline]
#[allow(dead_code)]
pub fn prefetch(data: *const usize) {
unsafe { prefetch_asm(data) }
}
Expand Down
8 changes: 4 additions & 4 deletions src/reg_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ impl RegContext {
self.regs.prefetch();
}

/// Create a new context
#[allow(dead_code)]
pub fn new(init: InitFn, arg: usize, start: *mut usize, stack: &Stack) -> RegContext {
/// Create a new context, only used in tests
#[cfg(test)]
fn new(init: InitFn, arg: usize, start: *mut usize, stack: &Stack) -> RegContext {
let mut ctx = RegContext::empty();
ctx.init_with(init, arg, start, stack);
ctx
Expand All @@ -48,7 +48,7 @@ impl RegContext {

/// Load the context and switch. This function will never return.
#[inline]
#[allow(dead_code)]
#[cfg(test)]
pub fn load(to_context: &RegContext) {
let mut cur = Registers::new();
let regs: &Registers = &to_context.regs;
Expand Down
1 change: 0 additions & 1 deletion src/rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ thread_local!(
static mut ROOT_CONTEXT_P: *mut Context = ptr::null_mut();

/// yield panic error types
#[allow(dead_code)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum Error {
/// Done panic
Expand Down
1 change: 0 additions & 1 deletion src/stack/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ impl Stack {
}

/// Point to the low end of the allocated stack
#[allow(dead_code)]
pub fn begin(&self) -> *mut usize {
self.buf.bottom as *mut _
}
Expand Down

0 comments on commit 25b25e6

Please sign in to comment.