Fix some warnings shown in nightly (#10012)

# Objective

Fix warnings:
- #[warn(clippy::needless_pass_by_ref_mut)]
- #[warn(elided_lifetimes_in_associated_constant)]

## Solution

- Remove mut
- add &'static

## Errors

```rust
warning: this argument is a mutable reference, but not used mutably
   --> crates/bevy_hierarchy/src/child_builder.rs:672:31
    |
672 |     fn assert_children(world: &mut World, parent: Entity, children: Option<&[Entity]>) {
    |                               ^^^^^^^^^^ help: consider changing to: `&World`
    |
    = note: this is cfg-gated and may require further changes
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
    = note: `#[warn(clippy::needless_pass_by_ref_mut)]` on by default
```


```rust
warning: `&` without an explicit lifetime name cannot be used here
   --> examples/shader/post_processing.rs:120:21
    |
120 |     pub const NAME: &str = "post_process";
    |                     ^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
    = note: `#[warn(elided_lifetimes_in_associated_constant)]` on by default
help: use the `'static` lifetime
    |
120 |     pub const NAME: &'static str = "post_process";
    |                      +++++++


```
This commit is contained in:
Ame :] 2023-10-05 00:41:09 -05:00 committed by GitHub
parent 86f7ef1bd7
commit 7541bf862c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -664,12 +664,12 @@ mod tests {
};
/// Assert the (non)existence and state of the child's [`Parent`] component.
fn assert_parent(world: &mut World, child: Entity, parent: Option<Entity>) {
fn assert_parent(world: &World, child: Entity, parent: Option<Entity>) {
assert_eq!(world.get::<Parent>(child).map(|p| p.get()), parent);
}
/// Assert the (non)existence and state of the parent's [`Children`] component.
fn assert_children(world: &mut World, parent: Entity, children: Option<&[Entity]>) {
fn assert_children(world: &World, parent: Entity, children: Option<&[Entity]>) {
assert_eq!(world.get::<Children>(parent).map(|c| &**c), children);
}

View file

@ -117,7 +117,7 @@ impl Plugin for PostProcessPlugin {
#[derive(Default)]
struct PostProcessNode;
impl PostProcessNode {
pub const NAME: &str = "post_process";
pub const NAME: &'static str = "post_process";
}
// The ViewNode trait is required by the ViewNodeRunner