Skip to content

Commit 5390be0

Browse files
committed
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.
1 parent 3af3334 commit 5390be0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

crates/bevy_asset/src/diagnostic/asset_count_diagnostics_plugin.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@ use bevy_diagnostic::{Diagnostic, DiagnosticId, Diagnostics};
44
use bevy_ecs::system::{IntoSystem, Res, ResMut};
55

66
/// Adds "asset count" diagnostic to an App
7-
#[derive(Default)]
87
pub struct AssetCountDiagnosticsPlugin<T: Asset> {
98
marker: std::marker::PhantomData<T>,
109
}
1110

11+
impl<T: Asset> Default for AssetCountDiagnosticsPlugin<T> {
12+
fn default() -> Self {
13+
Self {
14+
marker: std::marker::PhantomData,
15+
}
16+
}
17+
}
18+
1219
impl<T: Asset> Plugin for AssetCountDiagnosticsPlugin<T> {
1320
fn build(&self, app: &mut AppBuilder) {
1421
app.add_startup_system(Self::setup_system.system())

0 commit comments

Comments
 (0)