bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Swap most uses of allow in lints to expect

Open alice-i-cecile opened this issue 1 year ago • 8 comments

What problem does this solve or what need does it fill?

With the advent of Rust 1.81, we can now distinguish between lints that we haven't gotten around to fixing and those where the lint is wrong.

What solution would you like?

Most localized lints in Bevy should be expect: the only exception that comes to mind is missing_docs.

Leave the Cargo.toml lints set as allow, as funny as it would be to set a crate-level expect(type_complexity).

alice-i-cecile avatar Sep 05 '24 17:09 alice-i-cecile

I'd also like to turn on the new allow_attributes_without_reason lint as part of this.

alice-i-cecile avatar Sep 05 '24 17:09 alice-i-cecile

I'll take a stab at this!

BD103 avatar Sep 05 '24 17:09 BD103

If someone wants to work on this, I got a lot of progress done in #15118. Feel free to adopt it and follow my advice here for finishing it.

BD103 avatar Sep 13 '24 13:09 BD103

My suggestion for those tackling this is to handle this one crate at a time: that will ensure it's easier to complete and review smaller bits of work.

alice-i-cecile avatar Sep 13 '24 15:09 alice-i-cecile

Copying BD103's instructions/workflow for ease of reference. Also note that crate-level expect/missing_docs should be fixed in an upcoming Rust version.

I'm going to put this PR up for adoption. I no longer have the energy to work on it, and there are still a lot of crates left. If you want to adopt this, my workflow looked like this:

  1. Run cargo clippy --workspace --message-format=short
  2. cd into the first crate that raises warnings.
  3. Run cargo watch -c -x clippy until warnings stop appearing.
  4. Run cargo clippy --no-default-features and cargo clippy --all-features for good measure.
  5. Repeat step 1 until there are no more warning.

(Note that the current bug doesn't surface until --all-targets is specified, so usually worth adding that to the workflow. See #15321.)

bas-ie avatar Sep 21 '24 22:09 bas-ie

Keeping a list here for my own reference: these were not covered by the previous PR.

  • [x] bevy_core_pipeline has crate-level allow, needs crate-level expect later
  • [x] bevy_dev_tools no warnings, already looks pretty covered
  • [x] bevy_dylib already covered
  • [x] bevy_gilrs already covered
  • [x] bevy_gizmos none found
  • [ ] bevy_gltf
  • [x] bevy_input no warnings, looks pretty well-covered
  • [ ] bevy_internal
  • [ ] bevy_pbr
  • [ ] bevy_picking
  • [ ] bevy_render
  • [ ] bevy_sprite
  • [ ] bevy_state
  • [ ] bevy_text
  • [ ] bevy_ui
  • [ ] bevy_window
  • [ ] bevy_winit

bas-ie avatar Sep 21 '24 23:09 bas-ie

Just tracking things for myself... it looks like stable Rust 1.83 is 62 days away, so I have a reminder to revisit this end of November when we can rely on missing_docs working as expected.

bas-ie avatar Sep 27 '24 05:09 bas-ie

Looking into this again...

bas-ie avatar Nov 29 '24 19:11 bas-ie

@bas-ie, are we fully done with this at this point?

alice-i-cecile avatar Feb 05 '25 20:02 alice-i-cecile

I don't think so. I haven't looked specifically lately, but I think we just got the instances that were in BD's original PR and a few extras. I'll go hunting for more 👀

bas-ie avatar Feb 05 '25 21:02 bas-ie