Skip to content

Commit e4e3259

Browse files
Cargo fmt with unstable features (bevyengine#1903)
Fresh version of bevyengine#1670 off the latest main. Mostly fixing documentation wrapping.
1 parent 30c6ca6 commit e4e3259

File tree

20 files changed

+75
-63
lines changed

20 files changed

+75
-63
lines changed

crates/bevy_app/src/app_builder.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ impl AppBuilder {
185185

186186
/// Adds a new [State] with the given `initial` value.
187187
/// This inserts a new `State<T>` resource and adds a new "driver" to [CoreStage::Update].
188-
/// Each stage that uses `State<T>` for system run criteria needs a driver. If you need to use your state in a
189-
/// different stage, consider using [Self::add_state_to_stage] or manually adding [State::get_driver] to additional stages
190-
/// you need it in.
188+
/// Each stage that uses `State<T>` for system run criteria needs a driver. If you need to use
189+
/// your state in a different stage, consider using [Self::add_state_to_stage] or manually
190+
/// adding [State::get_driver] to additional stages you need it in.
191191
pub fn add_state<T>(&mut self, initial: T) -> &mut Self
192192
where
193193
T: Component + Debug + Clone + Eq + Hash,
@@ -197,9 +197,9 @@ impl AppBuilder {
197197

198198
/// Adds a new [State] with the given `initial` value.
199199
/// This inserts a new `State<T>` resource and adds a new "driver" to the given stage.
200-
/// Each stage that uses `State<T>` for system run criteria needs a driver. If you need to use your state in
201-
/// more than one stage, consider manually adding [State::get_driver] to the stages
202-
/// you need it in.
200+
/// Each stage that uses `State<T>` for system run criteria needs a driver. If you need to use
201+
/// your state in more than one stage, consider manually adding [State::get_driver] to the
202+
/// stages you need it in.
203203
pub fn add_state_to_stage<T>(&mut self, stage: impl StageLabel, initial: T) -> &mut Self
204204
where
205205
T: Component + Debug + Clone + Eq + Hash,

crates/bevy_ecs/src/component/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ impl ComponentTicks {
344344
}
345345

346346
/// Manually sets the change tick.
347-
/// Usually, this is done automatically via the [`DerefMut`](std::ops::DerefMut) implementation on [`Mut`](crate::world::Mut) or [`ResMut`](crate::system::ResMut) etc.
347+
/// Usually, this is done automatically via the [`DerefMut`](std::ops::DerefMut) implementation
348+
/// on [`Mut`](crate::world::Mut) or [`ResMut`](crate::system::ResMut) etc.
348349
///
349350
/// # Example
350351
/// ```rust,no_run

crates/bevy_ecs/src/schedule/stage.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,8 +891,7 @@ impl Stage for SystemStage {
891891
mod tests {
892892
use crate::{
893893
entity::Entity,
894-
query::ChangeTrackers,
895-
query::Changed,
894+
query::{ChangeTrackers, Changed},
896895
schedule::{
897896
BoxedSystemLabel, ExclusiveSystemDescriptorCoercion, ParallelSystemDescriptorCoercion,
898897
RunCriteria, RunCriteriaDescriptorCoercion, RunCriteriaPiping, ShouldRun,

crates/bevy_ecs/src/schedule/state.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ where
300300
}
301301

302302
/// Schedule a state change that replaces the full stack with the given state.
303-
/// This will fail if there is a scheduled operation, or if the given `state` matches the current state
303+
/// This will fail if there is a scheduled operation, or if the given `state` matches the
304+
/// current state
304305
pub fn replace(&mut self, state: T) -> Result<(), StateError> {
305306
if self.stack.last().unwrap() == &state {
306307
return Err(StateError::AlreadyInState);
@@ -314,7 +315,8 @@ where
314315
Ok(())
315316
}
316317

317-
/// Same as [Self::replace], but if there is already a next state, it will be overwritten instead of failing
318+
/// Same as [Self::replace], but if there is already a next state, it will be overwritten
319+
/// instead of failing
318320
pub fn overwrite_replace(&mut self, state: T) -> Result<(), StateError> {
319321
if self.stack.last().unwrap() == &state {
320322
return Err(StateError::AlreadyInState);

crates/bevy_ecs/src/storage/table.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ impl Table {
328328
let available_space = self.capacity - self.len();
329329
if available_space < amount {
330330
let min_capacity = self.len() + amount;
331-
// normally we would check if min_capacity is 0 for the below calculation, but amount > available_space and
332-
// available_space > 0, so min_capacity > 1
331+
// normally we would check if min_capacity is 0 for the below calculation, but amount >
332+
// available_space and available_space > 0, so min_capacity > 1
333333
let new_capacity =
334334
((min_capacity + self.grow_amount - 1) / self.grow_amount) * self.grow_amount;
335335
let reserve_amount = new_capacity - self.len();

crates/bevy_ecs/src/system/commands.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ impl<'a> Commands<'a> {
8686

8787
/// Creates a new entity with the components contained in `bundle`.
8888
///
89-
/// This returns an [`EntityCommands`] builder, which enables inserting more components and bundles
90-
/// using a "builder pattern".
89+
/// This returns an [`EntityCommands`] builder, which enables inserting more components and
90+
/// bundles using a "builder pattern".
9191
///
9292
/// Note that `bundle` is a [`Bundle`], which is a collection of components. [`Bundle`] is
9393
/// automatically implemented for tuples of components. You can also create your own bundle
@@ -212,9 +212,9 @@ impl<'a, 'b> EntityCommands<'a, 'b> {
212212
/// # Warning
213213
///
214214
/// It's possible to call this with a bundle, but this is likely not intended and
215-
/// [`Self::insert_bundle`] should be used instead. If `with` is called with a bundle, the bundle
216-
/// itself will be added as a component instead of the bundles' inner components each being
217-
/// added.
215+
/// [`Self::insert_bundle`] should be used instead. If `with` is called with a bundle, the
216+
/// bundle itself will be added as a component instead of the bundles' inner components each
217+
/// being added.
218218
///
219219
/// # Example
220220
///

crates/bevy_ecs/src/system/into_system.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ impl SystemState {
5151

5252
/// Conversion trait to turn something into a [`System`].
5353
///
54-
/// Use this to get a system from a function. Also note that every system implements this trait as well.
54+
/// Use this to get a system from a function. Also note that every system implements this trait as
55+
/// well.
5556
///
5657
/// # Examples
5758
///
@@ -106,9 +107,9 @@ pub struct InputMarker;
106107

107108
/// The [`System`] counter part of an ordinary function.
108109
///
109-
/// You get this by calling [`IntoSystem::system`] on a function that only accepts [`SystemParam`]s.
110-
/// The output of the system becomes the functions return type, while the input becomes the functions
111-
/// [`In`] tagged parameter or `()` if no such paramater exists.
110+
/// You get this by calling [`IntoSystem::system`] on a function that only accepts
111+
/// [`SystemParam`]s. The output of the system becomes the functions return type, while the input
112+
/// becomes the functions [`In`] tagged parameter or `()` if no such paramater exists.
112113
pub struct FunctionSystem<In, Out, Param, Marker, F>
113114
where
114115
Param: SystemParam,

crates/bevy_ecs/src/system/query.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ where
126126

127127
/// Runs `f` on each query result in parallel using the given task pool.
128128
///
129-
/// This can only be called for read-only queries, see [`Self::par_for_each_mut`] for write-queries.
129+
/// This can only be called for read-only queries, see [`Self::par_for_each_mut`] for
130+
/// write-queries.
130131
#[inline]
131132
pub fn par_for_each(
132133
&self,
@@ -270,7 +271,8 @@ where
270271
}
271272

272273
/// Gets a mutable reference to the [`Entity`]'s [`Component`] of the given type. This will fail
273-
/// if the entity does not have the given component type or the component does not match the query.
274+
/// if the entity does not have the given component type or the component does not match the
275+
/// query.
274276
///
275277
/// # Safety
276278
///
@@ -352,7 +354,8 @@ where
352354
}
353355
}
354356

355-
/// Gets the query result if it is only a single result, otherwise returns a [`QuerySingleError`].
357+
/// Gets the query result if it is only a single result, otherwise returns a
358+
/// [`QuerySingleError`].
356359
pub fn single_mut(&mut self) -> Result<<Q::Fetch as Fetch<'_>>::Item, QuerySingleError> {
357360
let mut query = self.iter_mut();
358361
let first = query.next();
@@ -381,8 +384,8 @@ pub enum QueryComponentError {
381384
NoSuchEntity,
382385
}
383386

384-
/// An error that occurs when evaluating a [`Query`] as a single expected resulted via [`Query::single`]
385-
/// or [`Query::single_mut`].
387+
/// An error that occurs when evaluating a [`Query`] as a single expected resulted via
388+
/// [`Query::single`] or [`Query::single_mut`].
386389
#[derive(Debug, Error)]
387390
pub enum QuerySingleError {
388391
#[error("No entities fit the query {0}")]

crates/bevy_ecs/src/system/system.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ impl SystemId {
3131
/// It's possible to specify explicit execution order between specific systems,
3232
/// see [SystemDescriptor](crate::schedule::SystemDescriptor).
3333
pub trait System: Send + Sync + 'static {
34-
/// The system's input. See [`In`](crate::system::In) for [`FunctionSystem`](crate::system::FunctionSystem)s.
34+
/// The system's input. See [`In`](crate::system::In) for
35+
/// [`FunctionSystem`](crate::system::FunctionSystem)s.
3536
type In;
3637
/// The system's output.
3738
type Out;

crates/bevy_input/src/input.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ where
7474
self.just_pressed.contains(&input)
7575
}
7676

77-
/// Clear the "just pressed" state of `input`. Future calls to [`Input::just_pressed`] for the given
78-
/// input will return false until a new press event occurs.
77+
/// Clear the "just pressed" state of `input`. Future calls to [`Input::just_pressed`] for the
78+
/// given input will return false until a new press event occurs.
7979
/// Returns true if `input` is currently "just pressed"
8080
pub fn clear_just_pressed(&mut self, input: T) -> bool {
8181
self.just_pressed.remove(&input)
@@ -86,8 +86,8 @@ where
8686
self.just_released.contains(&input)
8787
}
8888

89-
/// Clear the "just released" state of `input`. Future calls to [`Input::just_released`] for the given
90-
/// input will return false until a new release event occurs.
89+
/// Clear the "just released" state of `input`. Future calls to [`Input::just_released`] for the
90+
/// given input will return false until a new release event occurs.
9191
/// Returns true if `input` is currently "just released"
9292
pub fn clear_just_released(&mut self, input: T) -> bool {
9393
self.just_released.remove(&input)

0 commit comments

Comments
 (0)