Skip to content

Commit

Permalink
cargo fix, clippy fix, fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ezpuzz committed Jan 3, 2021
1 parent a3a5618 commit 97adc94
Show file tree
Hide file tree
Showing 31 changed files with 94 additions and 124 deletions.
2 changes: 1 addition & 1 deletion .rusty-hook.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[hooks]
pre-commit = [
"cargo check --workspace --features empty,optional",
"cargo check --workspace --all-targets --features empty,optional",
"cargo fix --workspace --features empty,optional --allow-dirty --allow-staged",
"cargo +nightly clippy -Z unstable-options --workspace --features empty,optional --fix --allow-dirty --allow-staged",
"cargo +nightly fmt --all",
Expand Down
14 changes: 4 additions & 10 deletions amethyst_animation/src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ pub trait AnimationSampling: Send + Sync + 'static {
type Channel: Debug + Clone + Hash + Eq + Send + Sync + 'static;

/// Apply a sample to a channel
fn apply_sample<'a>(
fn apply_sample(
&mut self,
channel: &Self::Channel,
data: &Self::Primitive,
buffer: &mut CommandBuffer,
);

/// Get the current sample for a channel
fn current_sample<'a>(&self, channel: &Self::Channel) -> Self::Primitive;
fn current_sample(&self, channel: &Self::Channel) -> Self::Primitive;

/// Get default primitive
fn default_primitive(channel: &Self::Channel) -> Self::Primitive;
Expand Down Expand Up @@ -273,18 +273,12 @@ pub enum ControlState {
impl ControlState {
/// Is the state `Running`
pub fn is_running(&self) -> bool {
match *self {
ControlState::Running(_) => true,
_ => false,
}
matches!(*self, ControlState::Running(_))
}

/// Is the state `Paused`
pub fn is_paused(&self) -> bool {
match *self {
ControlState::Paused(_) => true,
_ => false,
}
matches!(*self, ControlState::Paused(_))
}
}

Expand Down
10 changes: 3 additions & 7 deletions examples/arc_ball_camera/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Demonstrates the arc ball camera
use amethyst::{
assets::Loader,
assets::{DefaultLoader, Handle, Loader, LoaderBundle, ProcessingQueue},
controls::{ArcBallControl, ArcBallControlBundle, HideCursor},
core::{
frame_limiter::FrameRateLimitStrategy,
Expand All @@ -16,23 +16,19 @@ use amethyst::{
palette::{LinSrgba, Srgb},
plugins::{RenderShaded3D, RenderToWindow},
rendy::{
hal::command::ClearColor,
mesh::{Normal, Position, Tangent, TexCoord},
texture::palette::load_from_linear_rgba,
},
shape::Shape,
types::DefaultBackend,
types::{DefaultBackend, MeshData, TextureData},
Mesh, RenderingBundle, Texture,
},
utils::application_root_dir,
window::ScreenDimensions,
winit::event::{MouseButton, VirtualKeyCode},
Error,
};
use amethyst_assets::{DefaultLoader, Handle, LoaderBundle, ProcessingQueue};
use amethyst_rendy::{
rendy::hal::command::ClearColor,
types::{MeshData, TextureData},
};

struct ExampleState;

Expand Down
19 changes: 9 additions & 10 deletions examples/asset_custom/main.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
use amethyst::{
assets::{Asset, AssetStorage, Format, Handle, Loader, TypeUuid},
error::{Error, ResultExt},
assets::{
atelier_importer,
atelier_importer::{typetag, SerdeImportable},
register_asset_type, Asset, AssetProcessorSystem, AssetStorage, DefaultLoader, Format,
Handle, Loader, LoaderBundle, TypeUuid,
},
error::{format_err, Error, ResultExt},
prelude::*,
renderer::{types::DefaultBackend, RenderingBundle},
utils::application_root_dir,
};
use amethyst_assets::{
atelier_importer,
atelier_importer::{typetag, SerdeImportable},
register_asset_type, AssetProcessorSystem, DefaultLoader, LoaderBundle,
};
use amethyst_error::format_err;
use amethyst_rendy::{types::DefaultBackend, RenderingBundle};
use serde::{Deserialize, Serialize};

/// Custom asset representing an energy blast.
Expand Down Expand Up @@ -87,7 +86,7 @@ fn main() -> amethyst::Result<()> {
level_filter: amethyst::LogLevelFilter::Info,
module_levels: vec![
(
"amethyst_assets".to_string(),
"amethyst::assets".to_string(),
amethyst::LogLevelFilter::Debug,
),
(
Expand Down
10 changes: 4 additions & 6 deletions examples/asset_loading/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// TODO: Add asset loader directory store for the meshes.

use amethyst::{
assets::{DefaultLoader, Format, Handle, Loader},
assets::{AssetHandle, DefaultLoader, Format, Handle, Loader, LoaderBundle, ProcessingQueue},
core::{
math::Vector3,
transform::{Transform, TransformBundle},
Expand All @@ -21,13 +21,11 @@ use amethyst::{
mesh::{MeshBuilder, Normal, Position, TexCoord},
texture::palette::load_from_srgba,
},
types::{DefaultBackend, Mesh, MeshData},
RenderingBundle,
types::{DefaultBackend, Mesh, MeshData, TextureData},
RenderingBundle, Texture,
},
utils::application_root_dir,
};
use amethyst_assets::{AssetHandle, LoaderBundle, ProcessingQueue};
use amethyst_rendy::{types::TextureData, Texture};
use log::info;
use serde::{Deserialize, Serialize};
use type_uuid::TypeUuid;
Expand All @@ -36,7 +34,7 @@ use type_uuid::TypeUuid;
#[uuid = "f245dc2b-88a9-413e-bd51-f6c341c32017"]
struct Custom;

amethyst_assets::register_importer!(".custom", Custom);
amethyst::assets::register_importer!(".custom", Custom);
impl Format<MeshData> for Custom {
fn name(&self) -> &'static str {
"CUSTOM"
Expand Down
2 changes: 1 addition & 1 deletion examples/auto_fov/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const CLEAR_COLOR: ClearColor = ClearColor {
fn main() -> Result<(), Error> {
amethyst::start_logger(Default::default());

let app_dir = amethyst_utils::application_dir("examples")?;
let app_dir = amethyst::utils::application_dir("examples")?;
let display_config_path = app_dir.join("auto_fov/config/display.ron");
let assets_dir = app_dir.join("auto_fov/assets");

Expand Down
4 changes: 2 additions & 2 deletions examples/custom_render_pass/custom_pass.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use amethyst::{
core::ecs::{DispatcherBuilder, World},
error::Error,
prelude::*,
renderer::{
bundle::{RenderOrder, RenderPlan, RenderPlugin, Target},
Expand All @@ -16,12 +17,11 @@ use amethyst::{
shader::{Shader, SpirvShader},
},
submodules::{DynamicUniform, DynamicVertexBuffer},
system::GraphAuxData,
types::Backend,
util, ChangeDetection,
},
};
use amethyst_error::Error;
use amethyst_rendy::system::GraphAuxData;
use derivative::Derivative;
use glsl_layout::*;

Expand Down
7 changes: 4 additions & 3 deletions examples/custom_render_pass/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
mod custom_pass;

use amethyst::{
input::{is_close_requested, is_key_down, InputBundle, InputEvent, ScrollDirection},
assets::LoaderBundle,
input::{
is_close_requested, is_key_down, InputBundle, InputEvent, ScrollDirection, VirtualKeyCode,
},
prelude::*,
renderer::{
plugins::RenderToWindow, rendy::hal::command::ClearColor, types::DefaultBackend,
RenderingBundle,
},
utils::application_root_dir,
};
use amethyst_assets::LoaderBundle;
use amethyst_input::VirtualKeyCode;

use crate::custom_pass::{CustomUniformArgs, RenderCustom, Triangle};

Expand Down
2 changes: 1 addition & 1 deletion examples/events_custom_state_event/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use amethyst::{
},
derive::EventReader,
ecs::Resources,
input::InputEvent,
};
use amethyst_input::InputEvent;

/// Here's a copy of the original StateEvent with our own type added
#[derive(Clone, Debug, EventReader)]
Expand Down
6 changes: 2 additions & 4 deletions examples/fly_camera/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Demonstrates how to use the fly camera
use amethyst::{
assets::Loader,
assets::{DefaultLoader, Handle, Loader, LoaderBundle, ProcessingQueue},
controls::{FlyControl, FlyControlBundle, HideCursor},
core::{
frame_limiter::FrameRateLimitStrategy,
Expand All @@ -21,16 +21,14 @@ use amethyst::{
texture::palette::load_from_linear_rgba,
},
shape::Shape,
types::DefaultBackend,
types::{DefaultBackend, MeshData, TextureData},
Mesh, RenderingBundle, Texture,
},
utils::application_root_dir,
window::ScreenDimensions,
winit::event::{MouseButton, VirtualKeyCode},
Error,
};
use amethyst_assets::{DefaultLoader, Handle, LoaderBundle, ProcessingQueue};
use amethyst_rendy::types::{MeshData, TextureData};

//type MyPrefabData = BasicScenePrefab<(Vec<Position>, Vec<Normal>, Vec<TexCoord>)>;

Expand Down
2 changes: 1 addition & 1 deletion examples/gltf/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use amethyst::{
core::transform::{Transform, TransformBundle},
derive::PrefabData,
ecs::{Entity, ReadStorage, Write, WriteStorage},
gltf::{GltfSceneAsset, GltfSceneFormat, GltfSceneLoaderSystemDesc},
input::{is_close_requested, is_key_down, StringBindings, VirtualKeyCode},
prelude::*,
renderer::{
Expand All @@ -29,7 +30,6 @@ use amethyst::{
},
Error,
};
use amethyst_gltf::{GltfSceneAsset, GltfSceneFormat, GltfSceneLoaderSystemDesc};
use serde::{Deserialize, Serialize};

#[derive(Default)]
Expand Down
7 changes: 2 additions & 5 deletions examples/locale/main.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
//! Example showing how to load a Locale file as an Asset using the Loader.
use amethyst::{
assets::{AssetStorage, DefaultLoader, Handle, Loader},
assets::{AssetStorage, DefaultLoader, Handle, Loader, LoaderBundle},
ecs::*,
locale::*,
prelude::*,
renderer::{types::DefaultBackend, RenderingBundle},
utils::application_root_dir,
Error,
};
use amethyst_assets::LoaderBundle;
use amethyst_rendy::{
rendy::hal::command::ClearColor, types::DefaultBackend, RenderToWindow, RenderingBundle,
};

struct Example {
handle_en: Option<Handle<Locale>>,
Expand Down
6 changes: 2 additions & 4 deletions examples/material/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Displays spheres with physically based materials.
use amethyst::{
assets::Loader,
assets::{DefaultLoader, Handle, Loader, LoaderBundle, ProcessingQueue},
core::{
ecs::*,
transform::{Transform, TransformBundle},
Expand All @@ -17,15 +17,13 @@ use amethyst::{
texture::palette::load_from_linear_rgba,
},
shape::Shape,
types::DefaultBackend,
types::{DefaultBackend, MeshData, TextureData},
Mesh, RenderingBundle, Texture,
},
utils::application_root_dir,
window::ScreenDimensions,
Application, GameData, SimpleState, StateData,
};
use amethyst_assets::{DefaultLoader, Handle, LoaderBundle, ProcessingQueue};
use amethyst_rendy::types::{MeshData, TextureData};

struct Example;

Expand Down
5 changes: 3 additions & 2 deletions examples/net_server/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ use amethyst::{
ecs::{System, SystemBundle},
frame_limiter::FrameRateLimitStrategy,
},
network::simulation::{tcp::TcpNetworkBundle, NetworkSimulationEvent, TransportResource},
network::simulation::{
tcp::TcpNetworkBundle, NetworkSimulationEvent, NetworkSimulationTime, TransportResource,
},
prelude::*,
shrev::{EventChannel, ReaderId},
utils::application_root_dir,
Result,
};
use amethyst_network::simulation::NetworkSimulationTime;
use log::{error, info};
use systems::ParallelRunnable;

Expand Down
2 changes: 1 addition & 1 deletion examples/pong_tutorial_01/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Pong Tutorial 1
use amethyst::{
assets::LoaderBundle,
prelude::*,
renderer::{
plugins::{RenderFlat2D, RenderToWindow},
Expand All @@ -10,7 +11,6 @@ use amethyst::{
},
utils::application_root_dir,
};
use amethyst_assets::LoaderBundle;

pub struct Pong;

Expand Down
2 changes: 1 addition & 1 deletion examples/pong_tutorial_02/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
mod pong;

use amethyst::{
assets::LoaderBundle,
core::transform::TransformBundle,
prelude::*,
renderer::{
Expand All @@ -13,7 +14,6 @@ use amethyst::{
},
utils::application_root_dir,
};
use amethyst_assets::LoaderBundle;

use crate::pong::Pong;

Expand Down
3 changes: 1 addition & 2 deletions examples/pong_tutorial_02/pong.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use amethyst::{
assets::{DefaultLoader, Handle, Loader},
assets::{DefaultLoader, Handle, Loader, ProcessingQueue},
core::transform::Transform,
prelude::*,
renderer::{Camera, SpriteRender, SpriteSheet, Texture},
};
use amethyst_assets::ProcessingQueue;

const ARENA_HEIGHT: f32 = 100.0;
const ARENA_WIDTH: f32 = 100.0;
Expand Down
2 changes: 1 addition & 1 deletion examples/pong_tutorial_03/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod pong;
mod systems;

use amethyst::{
assets::LoaderBundle,
core::transform::TransformBundle,
input::InputBundle,
prelude::*,
Expand All @@ -15,7 +16,6 @@ use amethyst::{
},
utils::application_root_dir,
};
use amethyst_assets::LoaderBundle;
use systems::paddle::PaddleSystem;

use crate::pong::Pong;
Expand Down
3 changes: 1 addition & 2 deletions examples/pong_tutorial_03/pong.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use amethyst::{
assets::{DefaultLoader, Handle, Loader},
assets::{DefaultLoader, Handle, Loader, ProcessingQueue},
core::transform::Transform,
prelude::*,
renderer::{Camera, SpriteRender, SpriteSheet, Texture},
};
use amethyst_assets::ProcessingQueue;

pub const ARENA_HEIGHT: f32 = 100.0;
pub const ARENA_WIDTH: f32 = 100.0;
Expand Down
3 changes: 1 addition & 2 deletions examples/pong_tutorial_04/pong.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use amethyst::{
assets::{DefaultLoader, Handle, Loader},
assets::{DefaultLoader, Handle, Loader, ProcessingQueue},
core::{timing::Time, transform::Transform},
prelude::*,
renderer::{Camera, SpriteRender, SpriteSheet, Texture},
};
use amethyst_assets::ProcessingQueue;

pub const ARENA_HEIGHT: f32 = 100.0;
pub const ARENA_WIDTH: f32 = 100.0;
Expand Down
Loading

0 comments on commit 97adc94

Please sign in to comment.