Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to expect (adopted) #15301

Merged
merged 34 commits into from
Sep 20, 2024
Merged

Conversation

richchurcher
Copy link
Contributor

@richchurcher richchurcher commented Sep 19, 2024

Objective

Rust 1.81 released the #[expect(...)] attribute, which works like #[allow(...)] but throws a warning if the lint isn't raised. This is preferred to #[allow(...)] because it tells us when it can be removed.

Alice's recommendation seems well-taken, let's do this crate by crate now that @BD103 has done the lion's share of this!

(Relates to, but doesn't yet completely finish #15059.)

Crates this doesn't cover:

  • bevy_input
  • bevy_gilrs
  • bevy_window
  • bevy_winit
  • bevy_state
  • bevy_render
  • bevy_picking
  • bevy_core_pipeline
  • bevy_sprite
  • bevy_text
  • bevy_pbr
  • bevy_ui
  • bevy_gltf
  • bevy_gizmos
  • bevy_dev_tools
  • bevy_internal
  • bevy_dylib

@BD103
Copy link
Member

BD103 commented Sep 19, 2024

Thanks for picking this up! Ping me if you have any questions about how I approached this problem :)

#[allow(dead_code)]
#[expect(
dead_code,
reason = "`FlushGuard` never needs to be read, it just needs to be kept alive for the `App`'s lifetime."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so much more useful, wow.

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'd prefer to resolve that one TODO before merging but I won't block on it.

@alice-i-cecile alice-i-cecile added C-Code-Quality A section of code that is hard to understand or change A-Cross-Cutting Impacts the entire engine D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 19, 2024
Cargo.toml Outdated Show resolved Hide resolved
Copy link
Member

@chompaa chompaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor nits, otherwise LGTM.

crates/bevy_asset/src/processor/mod.rs Outdated Show resolved Hide resolved
crates/bevy_transform/src/systems.rs Outdated Show resolved Hide resolved
@alice-i-cecile
Copy link
Member

@BenjaminBrienen could I get your review here? :) Should all be straightforward; I'd just like a second set of eyes.

dead_code,
reason = "This function is only used when the `multi_threaded` feature is enabled, and when not on WASM."
)
)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to instead make intialize() feature-gated?

@richchurcher
Copy link
Contributor Author

Troubleshooting crate-level expect, they seem to all be failing 🤔

@@ -4,8 +4,7 @@
clippy::undocumented_unsafe_blocks,
clippy::ptr_cast_constness
)]
// FIXME(3492): remove once docs are ready
#![allow(missing_docs)]
#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
Copy link
Contributor

@BenjaminBrienen BenjaminBrienen Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mega-pedantic so feel free to ignore:
This reason message has a grammatical error called a comma splice, where two independent clauses are joined by a comma.
2 possible fixes:

  • "Not all docs are written yet. See #3492."
  • "Not all docs are written yet; see #3492."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take your point, but given it doesn't interfere with comprehension in this case I'll turn a blind eye to grammar 🙂

@richchurcher
Copy link
Contributor Author

I dare you to fail, CI.

Copy link
Contributor

Your PR increases Bevy Minimum Supported Rust Version. Please update the rust-version field in the root Cargo.toml file.

@richchurcher
Copy link
Contributor Author

I should not have dared 😆

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 20, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Sep 20, 2024
Merged via the queue into bevyengine:main with commit fd329c0 Sep 20, 2024
31 checks passed
@richchurcher richchurcher deleted the allow-to-expect branch September 20, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Cross-Cutting Impacts the entire engine C-Code-Quality A section of code that is hard to understand or change D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants