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 Mar 30, 2021
1 parent 949200a commit d2bc8bb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/detail/aarch64_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn initialize_call_frame(
const FP: usize = 29 - 19;
const LR: usize = 30 - 19;
const SP: usize = 31 - 19;

let sp = align_down(stack.end());

// These registers are frobbed by bootstrap_green_task into the right
Expand Down
11 changes: 5 additions & 6 deletions src/detail/x86_64_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,12 @@ pub use self::asm_impl::*;

// #[cfg_attr(nightly, repr(simd))]
#[repr(C)]
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
struct XMM(u32, u32, u32, u32);
struct Xmm(u32, u32, u32, u32);

impl XMM {
impl Xmm {
pub fn new(a: u32, b: u32, c: u32, d: u32) -> Self {
XMM(a, b, c, d)
Xmm(a, b, c, d)
}
}

Expand All @@ -183,14 +182,14 @@ impl XMM {
pub struct Registers {
gpr: [usize; 16],
// keep enough for place holder
_xmm: [XMM; 10],
_xmm: [Xmm; 10],
}

impl Registers {
pub fn new() -> Registers {
Registers {
gpr: [0; 16],
_xmm: [XMM::new(0, 0, 0, 0); 10],
_xmm: [Xmm::new(0, 0, 0, 0); 10],
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/gen_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ impl<'a, A, T, const LOCAL: bool> GeneratorObj<'a, A, T, LOCAL> {

/// Consumes the `Generator`, returning a wrapped raw pointer.
#[inline]
pub fn into_raw(g: Generator<'a, A, T>) -> *mut usize {
let ret = g.gen.as_ptr() as *mut usize;
std::mem::forget(g);
pub fn into_raw(self) -> *mut usize {
let ret = self.gen.as_ptr() as *mut usize;
std::mem::forget(self);
ret
}

Expand Down Expand Up @@ -190,7 +190,7 @@ impl<A> Gn<A> {
pub fn new_scoped<'a, T, F>(f: F) -> Generator<'a, A, T>
where
F: FnOnce(Scope<A, T>) -> T + Send + 'a,
T: Send+ 'a,
T: Send + 'a,
A: Send + 'a,
{
Self::new_scoped_opt(DEFAULT_STACK_SIZE, f)
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mod scope;
mod stack;
mod yield_;

pub use crate::gen_impl::{Generator, LocalGenerator, Gn};
pub use crate::gen_impl::{Generator, Gn, LocalGenerator};
pub use crate::rt::{get_local_data, is_generator, Error};
pub use crate::scope::Scope;
pub use crate::yield_::{
Expand Down
6 changes: 3 additions & 3 deletions tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ fn test_scoped_yield() {
// start g
g.raw_send(None);

for i in 1..100{
for i in 1..100 {
let data: usize = g.send(i);
assert_eq!(data, i);
};
}

// quit g
g.raw_send(None);
Expand Down Expand Up @@ -305,7 +305,7 @@ fn test_cancel() {
});

loop {
let i= g.next().unwrap();
let i = g.next().unwrap();
if i > 10 {
g.cancel();
break;
Expand Down

0 comments on commit d2bc8bb

Please sign in to comment.