We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latest as of writing: a5a457c
Wrote a simple asset type without dependencies:
#[derive(Asset, TypePath)] pub struct Rarity { pub name: SharedStr, pub color: Color, }
Received an "unused variable" warning.
cargo expand output:
cargo expand
pub struct Rarity { pub name: SharedStr, pub color: Color, } impl bevy::asset::Asset for Rarity {} impl bevy::asset::VisitAssetDependencies for Rarity { fn visit_dependencies( &self, visit: &mut impl FnMut(bevy::asset::UntypedAssetId), // <-- Issue seems to be here ) {} } impl bevy::reflect::TypePath for Rarity { fn type_path() -> &'static str { "myasset::item::Rarity" } fn short_type_path() -> &'static str { "Rarity" } fn type_ident() -> Option<&'static str> { ::core::option::Option::Some("Rarity") } fn crate_name() -> Option<&'static str> { ::core::option::Option::Some( "myasset::item".split(':').next().unwrap(), ) } fn module_path() -> Option<&'static str> { ::core::option::Option::Some("myasset::item") } }
The text was updated successfully, but these errors were encountered:
Fix unused variable warning for simple AssetV2 derives (#9961)
7a72bac
# Objective Fix #9960 ## Solution Make the `visit` parameter `_visit` if there are no dependencies. New `cargo expand` output: ```rust pub struct Rarity { pub name: SharedStr, pub color: Color, } impl bevy::asset::Asset for Rarity {} impl bevy::asset::VisitAssetDependencies for Rarity { fn visit_dependencies( &self, _visit: &mut impl FnMut(bevy::asset::UntypedAssetId), // <-- fixed ) {} } impl bevy::reflect::TypePath for Rarity { fn type_path() -> &'static str { "myasset::item::Rarity" } fn short_type_path() -> &'static str { "Rarity" } fn type_ident() -> Option<&'static str> { ::core::option::Option::Some("Rarity") } fn crate_name() -> Option<&'static str> { ::core::option::Option::Some( "myasset::item".split(':').next().unwrap(), ) } fn module_path() -> Option<&'static str> { ::core::option::Option::Some("myasset::item") } } ```
Fix unused variable warning for simple AssetV2 derives (bevyengine#9961)
0960432
# Objective Fix bevyengine#9960 ## Solution Make the `visit` parameter `_visit` if there are no dependencies. New `cargo expand` output: ```rust pub struct Rarity { pub name: SharedStr, pub color: Color, } impl bevy::asset::Asset for Rarity {} impl bevy::asset::VisitAssetDependencies for Rarity { fn visit_dependencies( &self, _visit: &mut impl FnMut(bevy::asset::UntypedAssetId), // <-- fixed ) {} } impl bevy::reflect::TypePath for Rarity { fn type_path() -> &'static str { "myasset::item::Rarity" } fn short_type_path() -> &'static str { "Rarity" } fn type_ident() -> Option<&'static str> { ::core::option::Option::Some("Rarity") } fn crate_name() -> Option<&'static str> { ::core::option::Option::Some( "myasset::item".split(':').next().unwrap(), ) } fn module_path() -> Option<&'static str> { ::core::option::Option::Some("myasset::item") } } ```
Successfully merging a pull request may close this issue.
Bevy version
Latest as of writing: a5a457c
What you did
Wrote a simple asset type without dependencies:
What went wrong
Received an "unused variable" warning.
Additional information
cargo expand
output:The text was updated successfully, but these errors were encountered: