Skip to content

Commit 7b8d502

Browse files
authored
Fix beta lints (#12980)
# Objective - Fixes #12976 ## Solution This one is a doozy. - Run `cargo +beta clippy --workspace --all-targets --all-features` and fix all issues - This includes: - Moving inner attributes to be outer attributes, when the item in question has both inner and outer attributes - Use `ptr::from_ref` in more scenarios - Extend the valid idents list used by `clippy:doc_markdown` with more names - Use `Clone::clone_from` when possible - Remove redundant `ron` import - Add backticks to **so many** identifiers and items - I'm sorry whoever has to review this --- ## Changelog - Added links to more identifiers in documentation.
1 parent 9dde99f commit 7b8d502

File tree

34 files changed

+116
-106
lines changed

34 files changed

+116
-106
lines changed

clippy.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
doc-valid-idents = ["GilRs", "glTF", "sRGB", "VSync", "WebGL2", "WebGPU", ".."]
1+
doc-valid-idents = [
2+
"GilRs",
3+
"glTF",
4+
"MacOS",
5+
"NVidia",
6+
"OpenXR",
7+
"sRGB",
8+
"VSync",
9+
"WebGL2",
10+
"WebGPU",
11+
"..",
12+
]

crates/bevy_asset/src/assets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub(crate) struct AssetIndexAllocator {
5151
/// A monotonically increasing index.
5252
next_index: AtomicU32,
5353
recycled_queue_sender: Sender<AssetIndex>,
54-
/// This receives every recycled AssetIndex. It serves as a buffer/queue to store indices ready for reuse.
54+
/// This receives every recycled [`AssetIndex`]. It serves as a buffer/queue to store indices ready for reuse.
5555
recycled_queue_receiver: Receiver<AssetIndex>,
5656
recycled_sender: Sender<AssetIndex>,
5757
recycled_receiver: Receiver<AssetIndex>,

crates/bevy_asset/src/meta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub enum AssetAction<LoaderSettings, ProcessSettings> {
7171
pub struct ProcessedInfo {
7272
/// A hash of the asset bytes and the asset .meta data
7373
pub hash: AssetHash,
74-
/// A hash of the asset bytes, the asset .meta data, and the `full_hash` of every process_dependency
74+
/// A hash of the asset bytes, the asset .meta data, and the `full_hash` of every `process_dependency`
7575
pub full_hash: AssetHash,
7676
/// Information about the "process dependencies" used to process this asset.
7777
pub process_dependencies: Vec<ProcessDependencyInfo>,

crates/bevy_asset/src/processor/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ pub(crate) struct ProcessorAssetInfo {
10581058
/// _This lock must be locked whenever a read or write to processed assets occurs_
10591059
/// There are scenarios where processed assets (and their metadata) are being read and written in multiple places at once:
10601060
/// * when the processor is running in parallel with an app
1061-
/// * when processing assets in parallel, the processor might read an asset's process_dependencies when processing new versions of those dependencies
1061+
/// * when processing assets in parallel, the processor might read an asset's `process_dependencies` when processing new versions of those dependencies
10621062
/// * this second scenario almost certainly isn't possible with the current implementation, but its worth protecting against
10631063
/// This lock defends against those scenarios by ensuring readers don't read while processed files are being written. And it ensures
10641064
/// Because this lock is shared across meta and asset bytes, readers can ensure they don't read "old" versions of metadata with "new" asset data.
@@ -1101,7 +1101,7 @@ pub struct ProcessorAssetInfos {
11011101
/// The "current" in memory view of the asset space. During processing, if path does not exist in this, it should
11021102
/// be considered non-existent.
11031103
/// NOTE: YOU MUST USE `Self::get_or_insert` or `Self::insert` TO ADD ITEMS TO THIS COLLECTION TO ENSURE
1104-
/// non_existent_dependants DATA IS CONSUMED
1104+
/// `non_existent_dependants` DATA IS CONSUMED
11051105
infos: HashMap<AssetPath<'static>, ProcessorAssetInfo>,
11061106
/// Dependants for assets that don't exist. This exists to track "dangling" asset references due to deleted / missing files.
11071107
/// If the dependant asset is added, it can "resolve" these dependencies and re-compute those assets.

crates/bevy_asset/src/server/info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub(crate) struct AssetInfo {
3535
/// [`LoadedAsset`]: crate::loader::LoadedAsset
3636
loader_dependencies: HashMap<AssetPath<'static>, AssetHash>,
3737
/// The number of handle drops to skip for this asset.
38-
/// See usage (and comments) in get_or_create_path_handle for context.
38+
/// See usage (and comments) in `get_or_create_path_handle` for context.
3939
handle_drops_to_skip: usize,
4040
}
4141

crates/bevy_core/src/task_pool_options.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub struct TaskPoolThreadAssignmentPolicy {
99
pub min_threads: usize,
1010
/// Under no circumstance use more than this many threads for this pool
1111
pub max_threads: usize,
12-
/// Target using this percentage of total cores, clamped by min_threads and max_threads. It is
12+
/// Target using this percentage of total cores, clamped by `min_threads` and `max_threads`. It is
1313
/// permitted to use 1.0 to try to use all remaining threads
1414
pub percent: f32,
1515
}
@@ -34,11 +34,11 @@ impl TaskPoolThreadAssignmentPolicy {
3434
/// set up [`TaskPoolPlugin`](super::TaskPoolPlugin)
3535
#[derive(Clone, Debug)]
3636
pub struct TaskPoolOptions {
37-
/// If the number of physical cores is less than min_total_threads, force using
38-
/// min_total_threads
37+
/// If the number of physical cores is less than `min_total_threads`, force using
38+
/// `min_total_threads`
3939
pub min_total_threads: usize,
40-
/// If the number of physical cores is greater than max_total_threads, force using
41-
/// max_total_threads
40+
/// If the number of physical cores is greater than `max_total_threads`, force using
41+
/// `max_total_threads`
4242
pub max_total_threads: usize,
4343

4444
/// Used to determine number of IO threads to allocate

crates/bevy_core_pipeline/src/tonemapping/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub enum Tonemapping {
149149
AgX,
150150
/// By Tomasz Stachowiak
151151
/// Has little hue shifting in the darks and mids, but lots in the brights. Brights desaturate across the spectrum.
152-
/// Is sort of between Reinhard and ReinhardLuminance. Conceptually similar to reinhard-jodie.
152+
/// Is sort of between Reinhard and `ReinhardLuminance`. Conceptually similar to reinhard-jodie.
153153
/// Designed as a compromise if you want e.g. decent skin tones in low light, but can't afford to re-do your
154154
/// VFX to look good without hue shifting.
155155
SomewhatBoringDisplayTransform,

crates/bevy_ecs/src/entity/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,10 +1060,8 @@ mod tests {
10601060
}
10611061

10621062
#[test]
1063+
#[allow(clippy::nonminimal_bool)] // This is intentionally testing `lt` and `ge` as separate functions.
10631064
fn entity_comparison() {
1064-
// This is intentionally testing `lt` and `ge` as separate functions.
1065-
#![allow(clippy::nonminimal_bool)]
1066-
10671065
assert_eq!(
10681066
Entity::from_raw_and_generation(123, NonZeroU32::new(456).unwrap()),
10691067
Entity::from_raw_and_generation(123, NonZeroU32::new(456).unwrap())

crates/bevy_ecs/src/event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ struct EventInstance<E: Event> {
172172
#[derive(Debug, Resource)]
173173
pub struct Events<E: Event> {
174174
/// Holds the oldest still active events.
175-
/// Note that a.start_event_count + a.len() should always === events_b.start_event_count.
175+
/// Note that `a.start_event_count + a.len()` should always be equal to `events_b.start_event_count`.
176176
events_a: EventSequence<E>,
177177
/// Holds the newer events.
178178
events_b: EventSequence<E>,

crates/bevy_ecs/src/identifier/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,8 @@ mod tests {
209209

210210
#[rustfmt::skip]
211211
#[test]
212+
#[allow(clippy::nonminimal_bool)] // This is intentionally testing `lt` and `ge` as separate functions.
212213
fn id_comparison() {
213-
// This is intentionally testing `lt` and `ge` as separate functions.
214-
#![allow(clippy::nonminimal_bool)]
215-
216214
assert!(Identifier::new(123, 456, IdKind::Entity).unwrap() == Identifier::new(123, 456, IdKind::Entity).unwrap());
217215
assert!(Identifier::new(123, 456, IdKind::Placeholder).unwrap() == Identifier::new(123, 456, IdKind::Placeholder).unwrap());
218216
assert!(Identifier::new(123, 789, IdKind::Entity).unwrap() != Identifier::new(123, 456, IdKind::Entity).unwrap());

0 commit comments

Comments
 (0)