Skip to content

Commit

Permalink
2018 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaeroxe committed Nov 25, 2018
1 parent 6433622 commit 0cef996
Show file tree
Hide file tree
Showing 165 changed files with 471 additions and 490 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ before_install:
before_script:
- export PATH=$PATH:/home/travis/.cargo/bin
- export RUSTFLAGS="-D warnings"
- |
if [ ${TRAVIS_RUST_VERSION} == "stable" ]
then
export RUSTFLAGS="-D warnings"
fi
# Generate documentation, compile the engine, run tests.
script:
Expand Down
13 changes: 7 additions & 6 deletions amethyst_animation/src/bundle.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
use std::{hash::Hash, marker};

use resources::AnimationSampling;
use skinning::VertexSkinningSystem;
use crate::{
resources::AnimationSampling,
skinning::VertexSkinningSystem,
systems::{
AnimationControlSystem, AnimationProcessor, SamplerInterpolationSystem, SamplerProcessor,
},
};

use amethyst_core::{
specs::prelude::{Component, DispatcherBuilder},
Result, SystemBundle,
};

use systems::{
AnimationControlSystem, AnimationProcessor, SamplerInterpolationSystem, SamplerProcessor,
};

/// Bundle for vertex skinning
///
/// This registers `VertexSkinningSystem`.
Expand Down
6 changes: 1 addition & 5 deletions amethyst_animation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
//! [ex_ani]: https://github.com/amethyst/amethyst/tree/master/examples/animation
//! [ex_gltf]: https://github.com/amethyst/amethyst/tree/master/examples/gltf
#![warn(missing_docs)]
#![cfg_attr(feature = "cargo-clippy", allow(type_complexity))] // complex project
#![warn(missing_docs, rust_2018_idioms, rust_2018_compatibility)]

extern crate amethyst_assets;
extern crate amethyst_core;
Expand All @@ -65,9 +64,6 @@ extern crate num_traits;
#[macro_use]
extern crate serde;

#[cfg(feature = "profiler")]
extern crate thread_profiler;

pub use self::{
bundle::{AnimationBundle, SamplingBundle, VertexSkinningBundle},
material::{MaterialChannel, MaterialPrimitive},
Expand Down
2 changes: 1 addition & 1 deletion amethyst_animation/src/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use minterpolate::InterpolationPrimitive;
use amethyst_assets::Handle;
use amethyst_renderer::{Material, Sprite, Texture, TextureOffset};

use {AnimationSampling, ApplyData, BlendMethod};
use crate::{AnimationSampling, ApplyData, BlendMethod};

/// Sampler primitive for Material animations
/// Note that material can only ever be animated with `Step`, or a panic will occur.
Expand Down
6 changes: 3 additions & 3 deletions amethyst_animation/src/prefab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use amethyst_core::specs::{
prelude::{Entity, Read, ReadExpect, WriteStorage},
};

use {Animation, AnimationHierarchy, AnimationSampling, AnimationSet, RestState, Sampler};
use crate::{Animation, AnimationHierarchy, AnimationSampling, AnimationSet, RestState, Sampler};

/// `PrefabData` for loading a single `Animation`
///
Expand Down Expand Up @@ -61,7 +61,7 @@ where
pub struct MissingAssetHandle;

impl Display for MissingAssetHandle {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
write!(f, "{:?}", self)
}
}
Expand All @@ -71,7 +71,7 @@ impl Error for MissingAssetHandle {
"AnimationPrefab was not populated with an asset handle prior to calling load_prefab."
}

fn cause(&self) -> Option<&Error> {
fn cause(&self) -> Option<&dyn Error> {
None
}
}
Expand Down
2 changes: 1 addition & 1 deletion amethyst_animation/src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ where

/// Create rest state for the hierarchy. Will copy the values from the base components for each
/// entity in the hierarchy.
pub fn rest_state<F>(&self, get_component: F, states: &mut WriteStorage<RestState<T>>)
pub fn rest_state<F>(&self, get_component: F, states: &mut WriteStorage<'_, RestState<T>>)
where
T: AnimationSampling + Clone,
F: Fn(Entity) -> Option<T>,
Expand Down
2 changes: 1 addition & 1 deletion amethyst_animation/src/sprite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use minterpolate::InterpolationPrimitive;
use amethyst_assets::Handle;
use amethyst_renderer::{SpriteRender, SpriteSheet};

use {AnimationSampling, ApplyData, BlendMethod};
use crate::{AnimationSampling, ApplyData, BlendMethod};

/// Sampler primitive for SpriteRender animations
/// Note that sprites can only ever be animated with `Step`, or a panic will occur.
Expand Down
36 changes: 18 additions & 18 deletions amethyst_animation/src/systems/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use amethyst_core::{
timing::secs_to_duration,
};

use resources::{
use crate::resources::{
Animation, AnimationCommand, AnimationControl, AnimationControlSet, AnimationHierarchy,
AnimationSampling, AnimationSet, ApplyData, ControlState, DeferStartRelation, RestState,
Sampler, SamplerControl, SamplerControlSet, StepDirection,
Expand Down Expand Up @@ -213,7 +213,7 @@ fn get_running_duration<T>(
entity: &Entity,
control: &AnimationControl<T>,
hierarchy: Option<&AnimationHierarchy<T>>,
samplers: &WriteStorage<SamplerControlSet<T>>,
samplers: &WriteStorage<'_, SamplerControlSet<T>>,
) -> f32
where
T: AnimationSampling,
Expand Down Expand Up @@ -281,12 +281,12 @@ fn process_animation_control<T>(
control: &mut AnimationControl<T>,
hierarchy: Option<&AnimationHierarchy<T>>,
sampler_storage: &AssetStorage<Sampler<T::Primitive>>,
samplers: &mut WriteStorage<SamplerControlSet<T>>,
rest_states: &mut WriteStorage<RestState<T>>,
targets: &ReadStorage<T>,
samplers: &mut WriteStorage<'_, SamplerControlSet<T>>,
rest_states: &mut WriteStorage<'_, RestState<T>>,
targets: &ReadStorage<'_, T>,
remove: &mut bool,
next_id: &mut u64,
apply_data: &<T as ApplyData>::ApplyData,
apply_data: &<T as ApplyData<'_>>::ApplyData,
) -> Option<ControlState>
where
T: AnimationSampling + Component + Clone,
Expand Down Expand Up @@ -434,10 +434,10 @@ fn start_animation<T>(
sampler_storage: &AssetStorage<Sampler<T::Primitive>>,
control: &AnimationControl<T>,
hierarchy: &AnimationHierarchy<T>,
samplers: &mut WriteStorage<SamplerControlSet<T>>,
rest_states: &mut WriteStorage<RestState<T>>,
targets: &ReadStorage<T>, // for rest state
apply_data: &<T as ApplyData>::ApplyData,
samplers: &mut WriteStorage<'_, SamplerControlSet<T>>,
rest_states: &mut WriteStorage<'_, RestState<T>>,
targets: &ReadStorage<'_, T>, // for rest state
apply_data: &<T as ApplyData<'_>>::ApplyData,
) -> bool
where
T: AnimationSampling + Component + Clone,
Expand Down Expand Up @@ -506,7 +506,7 @@ where
fn pause_animation<T>(
control_id: u64,
hierarchy: &AnimationHierarchy<T>,
samplers: &mut WriteStorage<SamplerControlSet<T>>,
samplers: &mut WriteStorage<'_, SamplerControlSet<T>>,
) where
T: AnimationSampling,
{
Expand All @@ -520,7 +520,7 @@ fn pause_animation<T>(
fn unpause_animation<T>(
control_id: u64,
hierarchy: &AnimationHierarchy<T>,
samplers: &mut WriteStorage<SamplerControlSet<T>>,
samplers: &mut WriteStorage<'_, SamplerControlSet<T>>,
) where
T: AnimationSampling,
{
Expand All @@ -534,7 +534,7 @@ fn unpause_animation<T>(
fn step_animation<T>(
control_id: u64,
hierarchy: &AnimationHierarchy<T>,
controls: &mut WriteStorage<SamplerControlSet<T>>,
controls: &mut WriteStorage<'_, SamplerControlSet<T>>,
sampler_storage: &AssetStorage<Sampler<T::Primitive>>,
direction: &StepDirection,
) where
Expand All @@ -550,7 +550,7 @@ fn step_animation<T>(
fn set_animation_input<T>(
control_id: u64,
hierarchy: &AnimationHierarchy<T>,
controls: &mut WriteStorage<SamplerControlSet<T>>,
controls: &mut WriteStorage<'_, SamplerControlSet<T>>,
input: f32,
) where
T: AnimationSampling,
Expand All @@ -565,7 +565,7 @@ fn set_animation_input<T>(
fn set_blend_weights<T>(
control_id: u64,
hierarchy: &AnimationHierarchy<T>,
controls: &mut WriteStorage<SamplerControlSet<T>>,
controls: &mut WriteStorage<'_, SamplerControlSet<T>>,
weights: &Vec<(usize, T::Channel, f32)>,
) where
T: AnimationSampling,
Expand All @@ -582,7 +582,7 @@ fn set_blend_weights<T>(
fn update_animation_rate<T>(
control_id: u64,
hierarchy: &AnimationHierarchy<T>,
samplers: &mut WriteStorage<SamplerControlSet<T>>,
samplers: &mut WriteStorage<'_, SamplerControlSet<T>>,
rate_multiplier: f32,
) where
T: AnimationSampling,
Expand All @@ -599,7 +599,7 @@ fn update_animation_rate<T>(
fn check_and_terminate_animation<T>(
control_id: u64,
hierarchy: &AnimationHierarchy<T>,
samplers: &mut WriteStorage<SamplerControlSet<T>>,
samplers: &mut WriteStorage<'_, SamplerControlSet<T>>,
) -> bool
where
T: AnimationSampling,
Expand Down Expand Up @@ -634,7 +634,7 @@ where
fn check_termination<T>(
control_id: u64,
hierarchy: &AnimationHierarchy<T>,
samplers: &WriteStorage<SamplerControlSet<T>>,
samplers: &WriteStorage<'_, SamplerControlSet<T>>,
) -> bool
where
T: AnimationSampling,
Expand Down
2 changes: 1 addition & 1 deletion amethyst_animation/src/systems/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use amethyst_assets::Processor;

use resources::{Animation, Sampler};
use crate::resources::{Animation, Sampler};

pub use self::{control::AnimationControlSystem, sampling::SamplerInterpolationSystem};

Expand Down
6 changes: 3 additions & 3 deletions amethyst_animation/src/systems/sampling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use amethyst_core::{
Time,
};

use resources::{
use crate::resources::{
AnimationSampling, ApplyData, BlendMethod, ControlState, EndControl, Sampler, SamplerControl,
SamplerControlSet,
};
Expand Down Expand Up @@ -116,7 +116,7 @@ fn process_sampler<T>(
) where
T: AnimationSampling,
{
use resources::ControlState::*;
use crate::resources::ControlState::*;

let (new_state, new_end) = update_duration_and_check(&control, sampler, time);

Expand Down Expand Up @@ -189,7 +189,7 @@ fn update_duration_and_check<T>(
where
T: AnimationSampling,
{
use resources::ControlState::*;
use crate::resources::ControlState::*;
// Update state with new duration
// Check duration for end of sampling
match control.state {
Expand Down
4 changes: 2 additions & 2 deletions amethyst_animation/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use amethyst_core::{
Transform,
};

use {
use crate::{
resources::{AnimationSampling, ApplyData, BlendMethod},
util::SamplerPrimitive,
};
Expand All @@ -28,7 +28,7 @@ impl AnimationSampling for Transform {
type Channel = TransformChannel;

fn apply_sample(&mut self, channel: &Self::Channel, data: &SamplerPrimitive<f32>, _: &()) {
use util::SamplerPrimitive::*;
use crate::util::SamplerPrimitive::*;

use self::TransformChannel::*;

Expand Down
4 changes: 2 additions & 2 deletions amethyst_animation/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use amethyst_core::{
specs::prelude::{Entity, WriteStorage},
};

use resources::{AnimationControlSet, AnimationSampling};
use crate::resources::{AnimationControlSet, AnimationSampling};

use self::SamplerPrimitive::*;

Expand All @@ -19,7 +19,7 @@ use self::SamplerPrimitive::*;
/// with the same id
/// - `T`: the component type that the animation applies to
pub fn get_animation_set<'a, I, T>(
controls: &'a mut WriteStorage<AnimationControlSet<I, T>>,
controls: &'a mut WriteStorage<'_, AnimationControlSet<I, T>>,
entity: Entity,
) -> Option<&'a mut AnimationControlSet<I, T>>
where
Expand Down
10 changes: 5 additions & 5 deletions amethyst_assets/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use amethyst_core::specs::storage::UnprotectedStorage;

use {ErrorKind, Handle, Reload, Result, ResultExt, SingleFile, Source};
use crate::{ErrorKind, Handle, Reload, Result, ResultExt, SingleFile, Source};

/// One of the three core traits of this crate.
///
Expand Down Expand Up @@ -51,7 +51,7 @@ pub trait Format<A: Asset>: Send + 'static {
fn import(
&self,
name: String,
source: Arc<Source>,
source: Arc<dyn Source>,
options: Self::Options,
create_reload: bool,
) -> Result<FormatValue<A>>;
Expand All @@ -62,7 +62,7 @@ pub struct FormatValue<A: Asset> {
/// The format data.
pub data: A::Data,
/// An optional reload structure
pub reload: Option<Box<Reload<A>>>,
pub reload: Option<Box<dyn Reload<A>>>,
}

impl<A: Asset> FormatValue<A> {
Expand Down Expand Up @@ -100,7 +100,7 @@ where
fn import(
&self,
name: String,
source: Arc<Source>,
source: Arc<dyn Source>,
options: Self::Options,
create_reload: bool,
) -> Result<FormatValue<A>> {
Expand All @@ -112,7 +112,7 @@ where
.chain_err(|| ErrorKind::Source)?;
let data = T::import(&self, b, options.clone())?;
let reload = SingleFile::new(self.clone(), m, options, name, source);
let reload = Some(Box::new(reload) as Box<Reload<A>>);
let reload = Some(Box::new(reload) as Box<dyn Reload<A>>);
Ok(FormatValue { data, reload })
} else {
let b = source.load(&name).chain_err(|| ErrorKind::Source)?;
Expand Down
2 changes: 1 addition & 1 deletion amethyst_assets/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{borrow::Borrow, hash::Hash};

use fnv::FnvHashMap;

use {Handle, WeakHandle};
use crate::{Handle, WeakHandle};

/// A simple cache for asset handles of type `A`.
/// This stores `WeakHandle`, so it doesn't keep the assets alive.
Expand Down
2 changes: 1 addition & 1 deletion amethyst_assets/src/formats.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Deserialize;

use {
use crate::{
error::{Error, ResultExt},
Asset, SimpleFormat,
};
Expand Down
2 changes: 1 addition & 1 deletion amethyst_assets/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::hash::Hash;

use amethyst_core::specs::{Read, ReadExpect};

use {Asset, AssetStorage, Format, Handle, Loader, Progress};
use crate::{Asset, AssetStorage, Format, Handle, Loader, Progress};

/// Helper type for loading assets
#[derive(SystemData)]
Expand Down
Loading

0 comments on commit 0cef996

Please sign in to comment.