about summary refs log tree commit diff
path: root/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-12-31 17:36:04 +0000
committerbors <bors@rust-lang.org>2021-12-31 17:36:04 +0000
commit490566bb38a3605cec7de1ca2e13955e305bc9e5 (patch)
treee6acb595faa37bad0bcb31c64800a501643d40b1 /tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff
parent0eff589afc83e21a03a168497bbab6b4dfbb4ef6 (diff)
parentb6bcf0c51b0d719cfd141c1c010b41ebe74f2abb (diff)
downloadrust-490566bb38a3605cec7de1ca2e13955e305bc9e5.tar.gz
rust-490566bb38a3605cec7de1ca2e13955e305bc9e5.zip
Auto merge of #8179 - nmathewson:unused_async_io_amount, r=xFrednet
Extend unused_io_amount to cover async io.

Clippy helpfully warns about code like this, telling you that you
probably meant "write_all":

    fn say_hi<W:Write>(w: &mut W) {
       w.write(b"hello").unwrap();
    }

This patch attempts to extend the lint so it also covers this
case:

    async fn say_hi<W:AsyncWrite>(w: &mut W) {
       w.write(b"hello").await.unwrap();
    }

(I've run into this second case several times in my own programming,
and so have my coworkers, so unless we're especially accident-prone
in this area, it's probably worth addressing?)

Since this is my first attempt at a clippy patch, I've probably
made all kinds of mistakes: please help me fix them?  I'd like
to learn more here.

Open questions I have:

  * Should this be a separate lint from unused_io_amount?  Maybe
    unused_async_io_amount?  If so, how should I structure their
    shared code?
  * Should this cover tokio's AsyncWrite too?
  * Is it okay to write lints for stuff that isn't part of
    the standard library?  I see that "regex" also has lints,
    and I figure that "futures" is probably okay too, since it's
    an official rust-lang repository.
  * What other tests are needed?
  * How should I improve the code?

Thanks for your time!

---

changelog: [`unused_io_amount`] now supports async read and write traits
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff')
0 files changed, 0 insertions, 0 deletions