Skip to content

Commit ecdacfd

Browse files
Fix some cargo doc warnings + add cargo doc ci (#557)
1 parent f97027d commit ecdacfd

File tree

11 files changed

+44
-14
lines changed

11 files changed

+44
-14
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ jobs:
2121
components: rustfmt
2222
- name: Check formatting
2323
run: cargo fmt -- --check
24+
doc:
25+
runs-on: ubuntu-latest
26+
env:
27+
RUSTDOCFLAGS: -D warnings
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: dtolnay/rust-toolchain@stable
31+
- uses: Swatinem/rust-cache@v2
32+
with:
33+
prefix-key: ${{ env.RUST_CACHE_KEY }}
34+
- name: Cargo doc
35+
run: cargo doc
2436
test:
2537
runs-on: ubuntu-latest
2638
env:

src/dynamics/rigid_body.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ use rapier::prelude::{
55
};
66
use std::ops::{Add, AddAssign, Sub, SubAssign};
77

8+
#[cfg(doc)]
9+
use rapier::dynamics::IntegrationParameters;
10+
811
/// The Rapier handle of a [`RigidBody`] that was inserted to the physics scene.
912
#[derive(Copy, Clone, Debug, Component)]
1013
pub struct RapierRigidBodyHandle(pub RigidBodyHandle);

src/geometry/collider.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ use rapier::prelude::{ColliderHandle, InteractionGroups, SharedShape};
1212
use crate::dynamics::{CoefficientCombineRule, MassProperties};
1313
use crate::math::Vect;
1414

15+
#[cfg(doc)]
16+
use rapier::{dynamics::RigidBody, geometry::ContactForceEvent};
17+
1518
/// The Rapier handle of a collider that was inserted to the physics scene.
1619
#[derive(Copy, Clone, Debug, Component)]
1720
pub struct RapierColliderHandle(pub ColliderHandle);
@@ -25,8 +28,8 @@ pub struct AsyncCollider(pub ComputedColliderShape);
2528
#[cfg(all(feature = "dim3", feature = "async-collider"))]
2629
#[derive(Component, Debug, Clone)]
2730
pub struct AsyncSceneCollider {
28-
/// Collider type for each scene mesh not included in [`named_shapes`]. If [`None`], then all
29-
/// shapes will be skipped for processing except [`named_shapes`].
31+
/// Collider type for each scene mesh not included in [`Self::named_shapes`]. If [`None`], then all
32+
/// shapes will be skipped for processing except [`Self::named_shapes`].
3033
pub shape: Option<ComputedColliderShape>,
3134
/// Shape types for meshes by name. If shape is [`None`], then it will be skipped for
3235
/// processing.
@@ -103,7 +106,7 @@ impl fmt::Debug for Collider {
103106
}
104107
}
105108

106-
/// Overwrites the default application of [`GlobalTransform::scale`] to a [`Collider`]'s shapes.
109+
/// Overwrites the default application of [`GlobalTransform`] scale to a [`Collider`]'s shapes.
107110
#[derive(Copy, Clone, Debug, PartialEq, Component, Reflect)]
108111
pub enum ColliderScale {
109112
/// This scale will be multiplied with the scale in the [`GlobalTransform`] component

src/geometry/shape_views/collider_view.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ use rapier::geometry::{RoundShape, SharedShape};
66
use rapier::parry::either::Either;
77
use rapier::parry::shape::TypedShape;
88

9+
#[cfg(doc)]
10+
use rapier::parry;
11+
912
/// Read-only access to the properties of a collider.
1013
#[derive(Copy, Clone)]
1114
pub enum ColliderView<'a> {
@@ -160,7 +163,7 @@ impl<'a> From<ColliderView<'a>> for SharedShape {
160163
}
161164

162165
impl<'a> ColliderView<'a> {
163-
/// Convert to [`parry::TypedShape`].
166+
/// Convert to [`parry::shape::TypedShape`].
164167
pub fn as_typed_shape(self) -> TypedShape<'a> {
165168
match self {
166169
ColliderView::Ball(BallView { raw: s }) => TypedShape::Ball(s),
@@ -208,7 +211,7 @@ impl<'a> ColliderView<'a> {
208211
}
209212
}
210213

211-
/// Convert to [`parry::SharedShape`].
214+
/// Convert to [`parry::shape::SharedShape`].
212215
pub fn to_shared_shape(self) -> SharedShape {
213216
match self {
214217
ColliderView::Ball(BallView { raw }) => SharedShape::new(*raw),

src/pipeline/events.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::collections::HashMap;
1010
use std::sync::RwLock;
1111

1212
#[cfg(doc)]
13-
use crate::prelude::ActiveEvents;
13+
use crate::prelude::{ActiveEvents, ContactForceEventThreshold};
1414

1515
/// Events occurring when two colliders start or stop colliding
1616
///
@@ -55,7 +55,7 @@ pub struct ContactForceEvent {
5555
// issue).
5656
/// A set of queues collecting events emitted by the physics engine.
5757
pub(crate) struct EventQueue<'a> {
58-
// Used ot retrieve the entity of colliders that have been removed from the simulation
58+
// Used to retrieve the entity of colliders that have been removed from the simulation
5959
// since the last physics step.
6060
pub deleted_colliders: &'a HashMap<ColliderHandle, Entity>,
6161
pub collision_events: RwLock<EventWriter<'a, CollisionEvent>>,

src/pipeline/query_filter.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ pub use rapier::pipeline::QueryFilterFlags;
44

55
use crate::geometry::CollisionGroups;
66

7+
#[cfg(doc)]
8+
use crate::prelude::RapierContext;
9+
710
/// A filter that describes what collider should be included or excluded from a scene query.
811
///
912
/// For testing manually check [`RapierContext::with_query_filter`].

src/plugin/configuration.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ use bevy::prelude::{FromWorld, Resource, World};
33
use crate::math::{Real, Vect};
44
use crate::plugin::RapierContext;
55

6+
#[cfg(doc)]
7+
use rapier::dynamics::IntegrationParameters;
8+
69
/// Difference between simulation and rendering time
710
#[derive(Resource, Default)]
811
pub struct SimulationToRenderTime {

src/plugin/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pub use self::configuration::{RapierConfiguration, SimulationToRenderTime, TimestepMode};
22
pub use self::context::RapierContext;
33
pub use self::plugin::{NoUserData, PhysicsSet, RapierPhysicsPlugin, RapierTransformPropagateSet};
4+
pub use narrow_phase::{ContactManifoldView, ContactPairView, ContactView, SolverContactView};
45

56
#[allow(clippy::type_complexity)]
67
#[allow(clippy::too_many_arguments)]

src/plugin/narrow_phase.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl RapierContext {
5151
///
5252
/// If this returns `None`, there is no contact between the two colliders.
5353
/// If this returns `Some`, then there may be a contact between the two colliders. Check the
54-
/// result [`ContactPair::has_any_active_collider`] method to see if there is an actual contact.
54+
/// result [`ContactPairView::has_any_active_contact`] method to see if there is an actual contact.
5555
pub fn contact_pair(&self, collider1: Entity, collider2: Entity) -> Option<ContactPairView> {
5656
let h1 = self.entity2collider.get(&collider1)?;
5757
let h2 = self.entity2collider.get(&collider2)?;
@@ -165,10 +165,12 @@ impl<'a> ContactManifoldView<'a> {
165165
self.raw.data.normal.into()
166166
}
167167

168+
/// The contacts that will be seen by the constraints solver for computing forces.
168169
pub fn num_solver_contacts(&self) -> usize {
169170
self.raw.data.solver_contacts.len()
170171
}
171172

173+
/// Gets the i-th solver contact.
172174
pub fn solver_contact(&self, i: usize) -> Option<SolverContactView> {
173175
self.raw
174176
.data

src/plugin/plugin.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ where
4141
self
4242
}
4343

44-
/// Specifies whether the plugin should setup each of its [`PhysicsStages`]
44+
/// Specifies whether the plugin should setup each of its [`PhysicsSet`]
4545
/// (`true`), or if the user will set them up later (`false`).
4646
///
4747
/// The default value is `true`.
@@ -74,7 +74,7 @@ where
7474
}
7575

7676
/// Provided for use when staging systems outside of this plugin using
77-
/// [`with_system_setup(false)`](Self::with_system_setup).
77+
/// [`with_default_system_setup(false)`](Self::with_default_system_setup).
7878
/// See [`PhysicsSet`] for a description of these systems.
7979
pub fn get_systems(set: PhysicsSet) -> SystemConfigs {
8080
match set {
@@ -134,19 +134,19 @@ impl<PhysicsHooksSystemParam> Default for RapierPhysicsPlugin<PhysicsHooksSystem
134134
}
135135
}
136136

137-
/// [`StageLabel`] for each phase of the plugin.
137+
/// [`SystemSet`] for each phase of the plugin.
138138
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone)]
139139
pub enum PhysicsSet {
140140
/// This set runs the systems responsible for synchronizing (and
141141
/// initializing) backend data structures with current component state.
142-
/// These systems typically run at the after [`CoreSet::Update`].
142+
/// These systems typically run at the after [`Update`].
143143
SyncBackend,
144144
/// The systems responsible for advancing the physics simulation, and
145145
/// updating the internal state for scene queries.
146146
/// These systems typically run immediately after [`PhysicsSet::SyncBackend`].
147147
StepSimulation,
148148
/// The systems responsible for updating
149-
/// [`crate::geometry::collider::CollidingEntities`] and writing
149+
/// [`crate::geometry::CollidingEntities`] and writing
150150
/// the result of the last simulation step into our `bevy_rapier`
151151
/// components and the [`GlobalTransform`] component.
152152
/// These systems typically run immediately after [`PhysicsSet::StepSimulation`].

0 commit comments

Comments
 (0)