Skip to content

Commit cbf3a8d

Browse files
committed
Simplify docs cfg_attr
1 parent 5432893 commit cbf3a8d

File tree

3 files changed

+36
-96
lines changed

3 files changed

+36
-96
lines changed

src/dynamics/rigid_body/mass_properties/components/mod.rs

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -807,22 +807,12 @@ impl From<AngularInertia> for AngularInertiaTensor {
807807
#[cfg_attr(feature = "3d", doc = " CenterOfMass::new(0.0, -0.5, 0.0),")]
808808
/// Transform::default(),
809809
/// ))
810-
#[cfg_attr(
811-
feature = "2d",
812-
doc = ".with_child((
813-
Collider::circle(1.0),
814-
Mass(5.0),
815-
Transform::from_xyz(0.0, 4.0, 0.0),
816-
));"
817-
)]
818-
#[cfg_attr(
819-
feature = "3d",
820-
doc = ".with_child((
821-
Collider::sphere(1.0),
822-
Mass(5.0),
823-
Transform::from_xyz(0.0, 4.0, 0.0),
824-
));"
825-
)]
810+
/// .with_child((
811+
#[cfg_attr(feature = "2d", doc = " Collider::circle(1.0),")]
812+
#[cfg_attr(feature = "3d", doc = " Collider::sphere(1.0),")]
813+
/// Mass(5.0),
814+
/// Transform::from_xyz(0.0, 4.0, 0.0),
815+
/// ));
826816
/// # }
827817
/// ```
828818
///
@@ -844,22 +834,12 @@ impl From<AngularInertia> for AngularInertiaTensor {
844834
#[cfg_attr(feature = "3d", doc = " CenterOfMass::new(0.0, -0.5, 0.0),")]
845835
/// Transform::default(),
846836
/// ))
847-
#[cfg_attr(
848-
feature = "2d",
849-
doc = ".with_child((
850-
Collider::circle(1.0),
851-
Mass(5.0),
852-
Transform::from_xyz(0.0, 4.0, 0.0),
853-
));"
854-
)]
855-
#[cfg_attr(
856-
feature = "3d",
857-
doc = ".with_child((
858-
Collider::sphere(1.0),
859-
Mass(5.0),
860-
Transform::from_xyz(0.0, 4.0, 0.0),
861-
));"
862-
)]
837+
/// .with_child((
838+
#[cfg_attr(feature = "2d", doc = " Collider::circle(1.0),")]
839+
#[cfg_attr(feature = "3d", doc = " Collider::sphere(1.0),")]
840+
/// Mass(5.0),
841+
/// Transform::from_xyz(0.0, 4.0, 0.0),
842+
/// ));
863843
/// # }
864844
/// ```
865845
///

src/dynamics/rigid_body/mass_properties/mod.rs

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,12 @@
9696
#![cfg_attr(feature = "3d", doc = " CenterOfMass::new(0.0, -0.5, 0.0),")]
9797
//! Transform::default(),
9898
//! ))
99-
#![cfg_attr(
100-
feature = "2d",
101-
doc = ".with_child((
102-
Collider::circle(1.0),
103-
Mass(5.0),
104-
Transform::from_xyz(0.0, 4.0, 0.0),
105-
));"
106-
)]
107-
#![cfg_attr(
108-
feature = "3d",
109-
doc = ".with_child((
110-
Collider::sphere(1.0),
111-
Mass(5.0),
112-
Transform::from_xyz(0.0, 4.0, 0.0),
113-
));"
114-
)]
99+
//! .with_child((
100+
#![cfg_attr(feature = "2d", doc = " Collider::circle(1.0),")]
101+
#![cfg_attr(feature = "3d", doc = " Collider::sphere(1.0),")]
102+
//! Mass(5.0),
103+
//! Transform::from_xyz(0.0, 4.0, 0.0),
104+
//! ));
115105
//! # }
116106
//! ```
117107
//!
@@ -137,22 +127,12 @@
137127
//! NoAutoCenterOfMass,
138128
//! Transform::default(),
139129
//! ))
140-
#![cfg_attr(
141-
feature = "2d",
142-
doc = ".with_child((
143-
Collider::circle(1.0),
144-
Mass(5.0),
145-
Transform::from_xyz(0.0, 4.0, 0.0),
146-
));"
147-
)]
148-
#![cfg_attr(
149-
feature = "3d",
150-
doc = ".with_child((
151-
Collider::sphere(1.0),
152-
Mass(5.0),
153-
Transform::from_xyz(0.0, 4.0, 0.0),
154-
));"
155-
)]
130+
//! .with_child((
131+
#![cfg_attr(feature = "2d", doc = " Collider::circle(1.0),")]
132+
#![cfg_attr(feature = "3d", doc = " Collider::sphere(1.0),")]
133+
//! Mass(5.0),
134+
//! Transform::from_xyz(0.0, 4.0, 0.0),
135+
//! ));
156136
//! # }
157137
//! ```
158138
//!

src/dynamics/rigid_body/mod.rs

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -184,22 +184,12 @@ use derive_more::From;
184184
#[cfg_attr(feature = "3d", doc = " CenterOfMass::new(0.0, -0.5, 0.0),")]
185185
/// Transform::default(),
186186
/// ))
187-
#[cfg_attr(
188-
feature = "2d",
189-
doc = ".with_child((
190-
Collider::circle(1.0),
191-
Mass(5.0),
192-
Transform::from_translation(Vec3::new(0.0, 4.0, 0.0)),
193-
));"
194-
)]
195-
#[cfg_attr(
196-
feature = "3d",
197-
doc = ".with_child((
198-
Collider::sphere(1.0),
199-
Mass(5.0),
200-
Transform::from_translation(Vec3::new(0.0, 4.0, 0.0)),
201-
));"
202-
)]
187+
/// .with_child((
188+
#[cfg_attr(feature = "2d", doc = " Collider::circle(1.0),")]
189+
#[cfg_attr(feature = "3d", doc = " Collider::sphere(1.0),")]
190+
/// Mass(5.0),
191+
/// Transform::from_xyz(0.0, 4.0, 0.0),
192+
/// ));
203193
/// # }
204194
/// ```
205195
///
@@ -225,22 +215,12 @@ use derive_more::From;
225215
/// NoAutoCenterOfMass,
226216
/// Transform::default(),
227217
/// ))
228-
#[cfg_attr(
229-
feature = "2d",
230-
doc = ".with_child((
231-
Collider::circle(1.0),
232-
Mass(5.0),
233-
Transform::from_translation(Vec3::new(0.0, 4.0, 0.0)),
234-
));"
235-
)]
236-
#[cfg_attr(
237-
feature = "3d",
238-
doc = ".with_child((
239-
Collider::sphere(1.0),
240-
Mass(5.0),
241-
Transform::from_translation(Vec3::new(0.0, 4.0, 0.0)),
242-
));"
243-
)]
218+
/// .with_child((
219+
#[cfg_attr(feature = "2d", doc = " Collider::circle(1.0),")]
220+
#[cfg_attr(feature = "3d", doc = " Collider::sphere(1.0),")]
221+
/// Mass(5.0),
222+
/// Transform::from_xyz(0.0, 4.0, 0.0),
223+
/// ));
244224
/// # }
245225
/// ```
246226
///

0 commit comments

Comments
 (0)