From 1c83a036c84d8eb4d035ab25f691c362cbf62fd7 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Sat, 7 Nov 2020 18:59:25 -0800 Subject: [PATCH] resolve conflicts and fix --- crates/bevy_ecs/hecs/macros/src/lib.rs | 5 ++--- crates/bevy_ecs/src/system/system_param.rs | 2 +- examples/2d/contributors.rs | 17 ++++++++++------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/crates/bevy_ecs/hecs/macros/src/lib.rs b/crates/bevy_ecs/hecs/macros/src/lib.rs index c4784766667ab..4e541ba187888 100644 --- a/crates/bevy_ecs/hecs/macros/src/lib.rs +++ b/crates/bevy_ecs/hecs/macros/src/lib.rs @@ -22,10 +22,9 @@ use proc_macro::TokenStream; use proc_macro2::{Span, TokenStream as TokenStream2}; use proc_macro_crate::crate_name; use quote::quote; -use syn::{parse_macro_input, DeriveInput, Error, Ident, Index, Lifetime, Path, Result}; use syn::{ - parse::ParseStream, parse_macro_input, Data, DataStruct, DeriveInput, Field, Fields, Ident, - Index, Lifetime, Path, + parse::ParseStream, parse_macro_input, Data, DataStruct, DeriveInput, Error, Field, Fields, + Ident, Index, Lifetime, Path, Result, }; /// Implement `Bundle` for a monomorphic struct diff --git a/crates/bevy_ecs/src/system/system_param.rs b/crates/bevy_ecs/src/system/system_param.rs index 7d148c498b2c4..01f9356f29a6e 100644 --- a/crates/bevy_ecs/src/system/system_param.rs +++ b/crates/bevy_ecs/src/system/system_param.rs @@ -12,7 +12,7 @@ pub trait SystemParam: Sized { fn init(system_state: &mut SystemState, world: &World, resources: &mut Resources); /// # Safety /// This call might access any of the input parameters in a safe way. Make sure the data access is safe in - /// the context of the system scheduler + /// the context of the system scheduler unsafe fn get_param( system_state: &mut SystemState, world: &World, diff --git a/examples/2d/contributors.rs b/examples/2d/contributors.rs index 12e3489abf4ea..a08a25f49f9ec 100644 --- a/examples/2d/contributors.rs +++ b/examples/2d/contributors.rs @@ -46,7 +46,7 @@ const COL_SELECTED: Color = Color::rgb_linear(5.0, 5.0, 5.0); const SHOWCASE_TIMER_SECS: f32 = 3.0; fn setup( - mut cmd: Commands, + commands: &mut Commands, asset_server: Res, mut materials: ResMut>, ) { @@ -54,7 +54,8 @@ fn setup( let texture_handle = asset_server.load("branding/icon.png"); - cmd.spawn(Camera2dComponents::default()) + commands + .spawn(Camera2dComponents::default()) .spawn(UiCameraComponents::default()); let mut sel = ContributorSelection { @@ -76,7 +77,8 @@ fn setup( let mut transform = Transform::from_translation(Vec3::new(pos.0, pos.1, 0.0)); *transform.scale.x_mut() *= if flipped { -1.0 } else { 1.0 }; - cmd.spawn((Contributor { color: col },)) + commands + .spawn((Contributor { color: col },)) .with(Velocity { translation: velocity, rotation: -dir * 5.0, @@ -94,16 +96,17 @@ fn setup( }) .with(transform); - let e = cmd.current_entity().unwrap(); + let e = commands.current_entity().unwrap(); sel.order.push((name, e)); } sel.order.shuffle(&mut rnd); - cmd.spawn((SelectTimer, Timer::from_seconds(SHOWCASE_TIMER_SECS, true))); + commands.spawn((SelectTimer, Timer::from_seconds(SHOWCASE_TIMER_SECS, true))); - cmd.spawn((ContributorDisplay,)) + commands + .spawn((ContributorDisplay,)) .with_bundle(TextComponents { style: Style { align_self: AlignSelf::FlexEnd, @@ -120,7 +123,7 @@ fn setup( ..Default::default() }); - cmd.insert_resource(sel); + commands.insert_resource(sel); } /// Finds the next contributor to display and selects the entity