Repository: bevyengine/bevy
File: crates/bevy_gizmos/src/gizmos.rs (Rust)

Code before:
        GizmosState::<Config, Clear>::apply(&mut state.state, system_meta, world);
    }

    #[inline]
    unsafe fn validate_param(
        state: &mut Self::State,
        system_meta: &SystemMeta,
        world: UnsafeWorldCell,
    ) -> Result<(), SystemParamValidationError> {
        // SAFETY: Delegated to existing `SystemParam` implementation.
        unsafe {
            GizmosState::<Config, Clear>::validate_param(&mut state.state, system_meta, world)?;
        }

        // SAFETY: Delegated to existing `SystemParam` implementation.
        let (_, f1) = unsafe {
            GizmosState::<Config, Clear>::get_param(
                &mut state.state,
                system_meta,
                world,
                world.change_tick(),
            )
        };
        // This if-block is to accommodate an Option<Gizmos> SystemParam.
        // The user may decide not to initialize a gizmo group, so its config will not exist.
        if f1.into_inner().get_config::<Config>().is_none() {
            Err(SystemParamValidationError::invalid::<Self>(
                format!("Requested config {} does not exist in `GizmoConfigStore`! Did you forget to add it using `app.init_gizmo_group<T>()`?", 
                Config::type_path())))
        } else {
            Ok(())
        }
    }

    #[inline]
    unsafe fn get_param<'w, 's>(
        state: &'s mut Self::State,
        system_meta: &SystemMeta,
        world: UnsafeWorldCell<'w>,
        change_tick: Tick,
    ) -> Self::Item<'w, 's> {
        // SAFETY: Delegated to existing `SystemParam` implementations.
        let (mut f0, f1) = unsafe {
            GizmosState::<Config, Clear>::get_param(
                &mut state.state,
                system_meta,
                world,
                change_tick,
            )
        };


Review comment (suggestion):
Very minor nit, but I bet you can leave off `into_inner()` and rely on the `Deref` impl.  

... Although you *do* need it in `get_param`, so maybe it's more consistent to use it here, too.

```suggestion
        if f1.get_config::<Config>().is_none() {
```

Code after:
        GizmosState::<Config, Clear>::apply(&mut state.state, system_meta, world);
    }

    #[inline]
    unsafe fn validate_param(
        state: &mut Self::State,
        system_meta: &SystemMeta,
        world: UnsafeWorldCell,
    ) -> Result<(), SystemParamValidationError> {
        // SAFETY: Delegated to existing `SystemParam` implementation.
        unsafe {
            GizmosState::<Config, Clear>::validate_param(&mut state.state, system_meta, world)?;
        }

        // SAFETY: Delegated to existing `SystemParam` implementation.
        let (_, f1) = unsafe {
            GizmosState::<Config, Clear>::get_param(
                &mut state.state,
                system_meta,
                world,
                world.change_tick(),
            )
        };
        // This if-block is to accommodate an Option<Gizmos> SystemParam.
        // The user may decide not to initialize a gizmo group, so its config will not exist.
        if f1.get_config::<Config>().is_none() {
            Err(SystemParamValidationError::invalid::<Self>(
                format!("Requested config {} does not exist in `GizmoConfigStore`! Did you forget to add it using `app.init_gizmo_group<T>()`?", 
                Config::type_path())))
        } else {
            Ok(())
        }
    }

    #[inline]
    unsafe fn get_param<'w, 's>(
        state: &'s mut Self::State,
        system_meta: &SystemMeta,
        world: UnsafeWorldCell<'w>,
        change_tick: Tick,
    ) -> Self::Item<'w, 's> {
        // SAFETY: Delegated to existing `SystemParam` implementations.
        let (mut f0, f1) = unsafe {
            GizmosState::<Config, Clear>::get_param(
                &mut state.state,
                system_meta,
                world,
                change_tick,
            )
        };