Clippy's revenge

After a grueling 36 hour session, with hardly any sleep, learning enough about Rust's async and tokio to get my latest program working, but mostly fighting with the compiler, grrr..., I finally got my creation humming along nicely. Clippy was all shut up and I was felling mighty proud of myself.

And then, I made one teeny weeny little change and BOOM, clippy put me back in my place:

error: any number modulo 1 will be 0
  --> src/main.rs:18:5
   |
18 | /     tokio::select! {
19 | |         _ = decoder::decoder_task() => {
20 | |             println!("decoder_task completed");
21 | |         }
22 | |     }
   | |_____^
   |
   = note: `#[deny(clippy::modulo_one)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#modulo_one
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

WTF? I don't have any modulo in my code. Never mind mod 1.

Well, except that little change was to remove a task from tokio::select! so that there was only one left. Somewhere in the bowels of tokio::select! there is a modulus operation going on...

2 Likes

I thought we fixed this. Are you using the newest version of Tokio? If so, please file a bug-report to Tokio.

1 Like
$ cat Cargo.toml
...
[dependencies]
...
tokio = { version = "0.2.21", features = ["full"] }
tokio-serial = "4.3.3-tokio-0.2.0-alpha.6"

$ rustc --version
rustc 1.46.0-nightly (346aec9b0 2020-07-11)
$ cargo  --version
cargo 1.46.0-nightly (4f74d9b2a 2020-07-08)
$ cargo  clippy
    Checking conq-sm-decoder v0.1.0 (/mnt/c/Users/michael/conveqs/conq-sm-decoder)
error: any number modulo 1 will be 0
  --> src/main.rs:18:5
   |
18 | /     tokio::select! {
19 | |         _ = decoder::decoder_task() => {
20 | |             println!("decoder_task completed");
21 | |         }
22 | |     }
   | |_____^
   |
   = note: `#[deny(clippy::modulo_one)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#modulo_one
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error; 4 warnings emitted

error: could not compile `conq-sm-decoder`.

To learn more, run the command again with --verbose.
$

Bug reported: Issue #2670

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.