From 5390be0871124b6c14782011e02645bc6ca29aa8 Mon Sep 17 00:00:00 2001 From: Nikita Zdanovitch Date: Sun, 2 May 2021 20:00:55 +0000 Subject: [PATCH] Replace derive(Default) with impl in AssetCountDiagnosticsPlugin (#2077) Hi, ran into this problem with the derive macro. It fails trying to derive the Default trait when the asset does not implements it also. This is unnecessary because this plugin does not need that from the asset type, just needs to create the phantom data. --- .../src/diagnostic/asset_count_diagnostics_plugin.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/bevy_asset/src/diagnostic/asset_count_diagnostics_plugin.rs b/crates/bevy_asset/src/diagnostic/asset_count_diagnostics_plugin.rs index 1fcf5e2ae1e0c..850a18d6e8360 100644 --- a/crates/bevy_asset/src/diagnostic/asset_count_diagnostics_plugin.rs +++ b/crates/bevy_asset/src/diagnostic/asset_count_diagnostics_plugin.rs @@ -4,11 +4,18 @@ use bevy_diagnostic::{Diagnostic, DiagnosticId, Diagnostics}; use bevy_ecs::system::{IntoSystem, Res, ResMut}; /// Adds "asset count" diagnostic to an App -#[derive(Default)] pub struct AssetCountDiagnosticsPlugin { marker: std::marker::PhantomData, } +impl Default for AssetCountDiagnosticsPlugin { + fn default() -> Self { + Self { + marker: std::marker::PhantomData, + } + } +} + impl Plugin for AssetCountDiagnosticsPlugin { fn build(&self, app: &mut AppBuilder) { app.add_startup_system(Self::setup_system.system())