Skip to content

unused_variables warning on Context #12

@gdesmott

Description

@gdesmott
#[async_handler]
impl Handler<Msg> for MyActor {
    type Result = usize;

    async fn handle(&mut self, _msg: Msg, ctx: &mut Context<Self>) -> Self::Result {
        dbg!(&ctx);
        self.0 = 30;
        sleep(Duration::from_secs(3)).await;
        self.0 -= 1;
        self.0
    }
}

This raises this warning while ctx is actually used.

warning: unused variable: `ctx`
  --> examples/hello.rs:22:43
   |
22 |     async fn handle(&mut self, _msg: Msg, ctx: &mut Context<Self>) -> Self::Result {
   |                                           ^^^ help: if this is intentional, prefix it with an underscore: `_ctx`
   |
   = note: `#[warn(unused_variables)]` on by default

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions