Skip to content

Commit

Permalink
Fix test crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaeroxe committed Dec 6, 2018
1 parent 15303b2 commit a3fe428
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 21 deletions.
2 changes: 0 additions & 2 deletions amethyst_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ mod resize;
mod text;
mod transform;



pub use self::{
action_components::{OnUiActionImage, OnUiActionSound},
bundle::UiBundle,
Expand Down
16 changes: 8 additions & 8 deletions tests/amethyst_test/src/amethyst_application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ type BundleAddFn = SendBoxFnOnce<
// In addition, it requires the `World` (and hence the `ApplicationBuilder`) to be instantiated
// in a scope greater than the `AmethystApplication`'s lifetime, which detracts from the
// ergonomics of this test harness.
type FnResourceAdd = Box<FnMut(&mut World) + Send>;
type FnState<T, E> = SendBoxFnOnce<'static, (), Box<State<T, E>>>;
type FnResourceAdd = Box<dyn FnMut(&mut World) + Send>;
type FnState<T, E> = SendBoxFnOnce<'static, (), Box<dyn State<T, E>>>;

type DefaultPipeline = PipelineBuilder<
Queue<(
Expand Down Expand Up @@ -220,12 +220,12 @@ where
{
let game_data = bundle_add_fns.into_iter().fold(
Ok(GameDataBuilder::default()),
|game_data: Result<GameDataBuilder>, function: BundleAddFn| {
|game_data: Result<GameDataBuilder<'_, '_>>, function: BundleAddFn| {
game_data.and_then(|game_data| function.call(game_data))
},
)?;

let mut states = Vec::<Box<State<GameData<'static, 'static>, E>>>::new();
let mut states = Vec::<Box<dyn State<GameData<'static, 'static>, E>>>::new();
state_fns
.into_iter()
.rev()
Expand Down Expand Up @@ -474,7 +474,7 @@ where
FnStateLocal: FnOnce() -> S + Send + Sync + 'static,
{
// Box up the state
let closure = move || Box::new((state_fn)()) as Box<State<T, E>>;
let closure = move || Box::new((state_fn)()) as Box<dyn State<T, E>>;
self.state_fns.push(SendBoxFnOnce::from(closure));
self
}
Expand Down Expand Up @@ -1047,7 +1047,7 @@ mod test {
E: Send + Sync + 'static,
{
next_state: Option<S>,
state_data: PhantomData<State<GameData<'a, 'b>, E>>,
state_data: PhantomData<dyn State<GameData<'a, 'b>, E>>,
}
impl<'a, 'b, S, E> LoadingState<'a, 'b, S, E>
where
Expand All @@ -1066,7 +1066,7 @@ mod test {
S: State<GameData<'a, 'b>, E> + 'static,
E: Send + Sync + 'static,
{
fn update(&mut self, data: StateData<GameData>) -> Trans<GameData<'a, 'b>, E> {
fn update(&mut self, data: StateData<'_, GameData<'_, '_>>) -> Trans<GameData<'a, 'b>, E> {
data.data.update(&data.world);
data.world.add_resource(LoadResource);
Trans::Switch(Box::new(self.next_state.take().unwrap()))
Expand Down Expand Up @@ -1098,7 +1098,7 @@ mod test {
S: State<T, E> + 'static,
E: Send + Sync + 'static,
{
fn update(&mut self, _data: StateData<T>) -> Trans<T, E> {
fn update(&mut self, _data: StateData<'_, T>) -> Trans<T, E> {
Trans::Switch(Box::new(self.next_state.take().unwrap()))
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/amethyst_test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,13 @@
//! # }
//! ```
extern crate amethyst;
extern crate boxfnonce;
use amethyst;

#[macro_use]
extern crate derivative;
#[macro_use]
extern crate derive_new;
extern crate hetseq;

#[macro_use]
extern crate lazy_static;

Expand Down
6 changes: 3 additions & 3 deletions tests/amethyst_test/src/state/custom_dispatcher_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ where
T: GameUpdate,
E: Send + Sync + 'static,
{
fn on_start(&mut self, mut data: StateData<T>) {
fn on_start(&mut self, mut data: StateData<'_, T>) {
self.initialize_dispatcher(&mut data.world);
}

fn on_stop(&mut self, _data: StateData<T>) {
fn on_stop(&mut self, _data: StateData<'_, T>) {
self.terminate_dispatcher();
}

fn update(&mut self, data: StateData<T>) -> Trans<T, E> {
fn update(&mut self, data: StateData<'_, T>) -> Trans<T, E> {
data.data.update(&data.world);
self.dispatcher.as_mut().unwrap().dispatch(&data.world.res);

Expand Down
2 changes: 1 addition & 1 deletion tests/amethyst_test/src/state/function_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ where
T: GameUpdate,
E: Send + Sync + 'static,
{
fn update(&mut self, mut data: StateData<T>) -> Trans<T, E> {
fn update(&mut self, mut data: StateData<'_, T>) -> Trans<T, E> {
data.data.update(&data.world);

(self.function)(&mut data.world);
Expand Down
2 changes: 1 addition & 1 deletion tests/amethyst_test/src/state/pop_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ impl<T, E> State<T, E> for PopState
where
E: Send + Sync + 'static,
{
fn update(&mut self, _data: StateData<T>) -> Trans<T, E> {
fn update(&mut self, _data: StateData<'_, T>) -> Trans<T, E> {
Trans::Pop
}
}
4 changes: 2 additions & 2 deletions tests/amethyst_test/src/state/sequencer_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ where
{
/// States to switch through, in reverse order.
#[derivative(Debug = "ignore")]
states: Vec<Box<State<T, E>>>,
states: Vec<Box<dyn State<T, E>>>,
}

impl<T, E> State<T, E> for SequencerState<T, E>
where
E: Send + Sync + 'static,
{
fn update(&mut self, _data: StateData<T>) -> Trans<T, E> {
fn update(&mut self, _data: StateData<'_, T>) -> Trans<T, E> {
if let Some(state) = self.states.pop() {
Trans::Push(state)
} else {
Expand Down
2 changes: 1 addition & 1 deletion tests/amethyst_test/src/system_injection_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use amethyst::ecs::prelude::*;
#[derive(Debug, new)]
pub(crate) struct SystemInjectionBundle<'a, Sys>
where
Sys: for<'s> System<'s> + Send + 'a,
Sys: for<'s> System<'s> + Send,
{
/// `System` to add to the dispatcher.
system: Sys,
Expand Down

0 comments on commit a3fe428

Please sign in to comment.