From 26b17f27a284dafa85414081d98332b13605fd70 Mon Sep 17 00:00:00 2001 From: Olivia Date: Sun, 21 Nov 2021 20:00:55 +0000 Subject: [PATCH 1/2] Style fix: imports on one line --- .../src/systems/input_system.rs | 4 ++-- .../src/systems/rendering_system.rs | 10 +++++----- code/rust-sokoban-c02-05/src/resources.rs | 4 ++-- .../src/systems/input_system.rs | 4 ++-- .../src/systems/rendering_system.rs | 12 +++++------ code/rust-sokoban-c03-01/src/components.rs | 4 ++-- code/rust-sokoban-c03-01/src/resources.rs | 4 ++-- .../src/systems/input_system.rs | 4 ++-- .../src/systems/rendering_system.rs | 12 +++++------ code/rust-sokoban-c03-02/src/components.rs | 4 ++-- code/rust-sokoban-c03-02/src/resources.rs | 4 ++-- .../src/systems/input_system.rs | 4 ++-- .../src/systems/rendering_system.rs | 14 ++++++------- code/rust-sokoban-c03-03/src/components.rs | 4 ++-- code/rust-sokoban-c03-03/src/resources.rs | 4 ++-- .../src/systems/input_system.rs | 4 ++-- .../src/systems/rendering_system.rs | 13 ++++++------ code/rust-sokoban-c03-04/src/components.rs | 4 ++-- code/rust-sokoban-c03-04/src/resources.rs | 4 ++-- .../src/systems/input_system.rs | 4 ++-- .../src/systems/rendering_system.rs | 18 ++++++++--------- code/rust-sokoban-c03-05/src/components.rs | 4 ++-- code/rust-sokoban-c03-05/src/resources.rs | 4 ++-- .../src/systems/input_system.rs | 4 ++-- .../src/systems/rendering_system.rs | 18 ++++++++--------- code/rust-sokoban-c04-01/src/components.rs | 4 ++-- code/rust-sokoban-c04-01/src/resources.rs | 4 ++-- .../src/systems/input_system.rs | 4 ++-- .../src/systems/rendering_system.rs | 20 +++++++++---------- 29 files changed, 100 insertions(+), 101 deletions(-) diff --git a/code/rust-sokoban-c02-04/src/systems/input_system.rs b/code/rust-sokoban-c02-04/src/systems/input_system.rs index c7ae3e2..0b77146 100644 --- a/code/rust-sokoban-c02-04/src/systems/input_system.rs +++ b/code/rust-sokoban-c02-04/src/systems/input_system.rs @@ -2,8 +2,8 @@ use crate::components::*; use crate::constants::*; use crate::resources::InputQueue; use ggez::event::KeyCode; -use specs::world::Index; -use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage}; +use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage}; + use std::collections::HashMap; pub struct InputSystem {} diff --git a/code/rust-sokoban-c02-04/src/systems/rendering_system.rs b/code/rust-sokoban-c02-04/src/systems/rendering_system.rs index cb1f9ba..d0c5693 100644 --- a/code/rust-sokoban-c02-04/src/systems/rendering_system.rs +++ b/code/rust-sokoban-c02-04/src/systems/rendering_system.rs @@ -1,11 +1,11 @@ + + use crate::components::*; use crate::constants::TILE_WIDTH; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; -use glam::Vec2; -use ggez::Context; + +use ggez::{Context, graphics::{self, DrawParam, Image}}; use specs::{Join, ReadStorage, System}; +use glam::Vec2; pub struct RenderingSystem<'a> { pub context: &'a mut Context, diff --git a/code/rust-sokoban-c02-05/src/resources.rs b/code/rust-sokoban-c02-05/src/resources.rs index b62b11a..b319be1 100644 --- a/code/rust-sokoban-c02-05/src/resources.rs +++ b/code/rust-sokoban-c02-05/src/resources.rs @@ -1,7 +1,7 @@ use ggez::event::KeyCode; use specs::World; -use std::fmt; -use std::fmt::Display; + +use std::fmt::{self, Display}; // Resources #[derive(Default)] diff --git a/code/rust-sokoban-c02-05/src/systems/input_system.rs b/code/rust-sokoban-c02-05/src/systems/input_system.rs index 5106041..292988f 100644 --- a/code/rust-sokoban-c02-05/src/systems/input_system.rs +++ b/code/rust-sokoban-c02-05/src/systems/input_system.rs @@ -1,9 +1,9 @@ use crate::components::*; use crate::constants::*; use crate::resources::{InputQueue, Gameplay}; -use ggez::event::KeyCode; -use specs::world::Index; +use specs::{world::Index, event::KeyCode}; use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage}; + use std::collections::HashMap; pub struct InputSystem {} diff --git a/code/rust-sokoban-c02-05/src/systems/rendering_system.rs b/code/rust-sokoban-c02-05/src/systems/rendering_system.rs index c398795..2942a42 100644 --- a/code/rust-sokoban-c02-05/src/systems/rendering_system.rs +++ b/code/rust-sokoban-c02-05/src/systems/rendering_system.rs @@ -1,13 +1,13 @@ + + + use crate::components::*; use crate::resources::*; use crate::constants::TILE_WIDTH; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; -use ggez::graphics::Color; -use glam::Vec2; -use ggez::Context; + +use ggez::{Context, graphics::{self, DrawParam, Image, Color}}; use specs::{Join, ReadStorage, System, Read}; +use glam::Vec2; pub struct RenderingSystem<'a> { pub context: &'a mut Context, diff --git a/code/rust-sokoban-c03-01/src/components.rs b/code/rust-sokoban-c03-01/src/components.rs index 39088f1..6a1deea 100644 --- a/code/rust-sokoban-c03-01/src/components.rs +++ b/code/rust-sokoban-c03-01/src/components.rs @@ -1,6 +1,6 @@ use specs::{Component, NullStorage, VecStorage, World, WorldExt}; -use std::fmt; -use std::fmt::Display; + +use std::fmt::{self, Display}; // Components #[derive(Debug, Component, Clone, Copy)] diff --git a/code/rust-sokoban-c03-01/src/resources.rs b/code/rust-sokoban-c03-01/src/resources.rs index b62b11a..b319be1 100644 --- a/code/rust-sokoban-c03-01/src/resources.rs +++ b/code/rust-sokoban-c03-01/src/resources.rs @@ -1,7 +1,7 @@ use ggez::event::KeyCode; use specs::World; -use std::fmt; -use std::fmt::Display; + +use std::fmt::{self, Display}; // Resources #[derive(Default)] diff --git a/code/rust-sokoban-c03-01/src/systems/input_system.rs b/code/rust-sokoban-c03-01/src/systems/input_system.rs index 5106041..74ef39a 100644 --- a/code/rust-sokoban-c03-01/src/systems/input_system.rs +++ b/code/rust-sokoban-c03-01/src/systems/input_system.rs @@ -2,8 +2,8 @@ use crate::components::*; use crate::constants::*; use crate::resources::{InputQueue, Gameplay}; use ggez::event::KeyCode; -use specs::world::Index; -use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage}; +use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage}; + use std::collections::HashMap; pub struct InputSystem {} diff --git a/code/rust-sokoban-c03-01/src/systems/rendering_system.rs b/code/rust-sokoban-c03-01/src/systems/rendering_system.rs index c398795..2942a42 100644 --- a/code/rust-sokoban-c03-01/src/systems/rendering_system.rs +++ b/code/rust-sokoban-c03-01/src/systems/rendering_system.rs @@ -1,13 +1,13 @@ + + + use crate::components::*; use crate::resources::*; use crate::constants::TILE_WIDTH; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; -use ggez::graphics::Color; -use glam::Vec2; -use ggez::Context; + +use ggez::{Context, graphics::{self, DrawParam, Image, Color}}; use specs::{Join, ReadStorage, System, Read}; +use glam::Vec2; pub struct RenderingSystem<'a> { pub context: &'a mut Context, diff --git a/code/rust-sokoban-c03-02/src/components.rs b/code/rust-sokoban-c03-02/src/components.rs index 78a8cf4..9f4f26d 100644 --- a/code/rust-sokoban-c03-02/src/components.rs +++ b/code/rust-sokoban-c03-02/src/components.rs @@ -1,6 +1,6 @@ use specs::{Component, NullStorage, VecStorage, World, WorldExt}; -use std::fmt; -use std::fmt::Display; + +use std::fmt::{self, Display}; // Components #[derive(Debug, Component, Clone, Copy)] diff --git a/code/rust-sokoban-c03-02/src/resources.rs b/code/rust-sokoban-c03-02/src/resources.rs index 517b79d..25c460f 100644 --- a/code/rust-sokoban-c03-02/src/resources.rs +++ b/code/rust-sokoban-c03-02/src/resources.rs @@ -1,7 +1,7 @@ use ggez::event::KeyCode; use specs::World; -use std::fmt; -use std::{fmt::Display, time::Duration}; + +use std::{fmt::{self, Display}, time::Duration}; // Resources #[derive(Default)] diff --git a/code/rust-sokoban-c03-02/src/systems/input_system.rs b/code/rust-sokoban-c03-02/src/systems/input_system.rs index 5106041..74ef39a 100644 --- a/code/rust-sokoban-c03-02/src/systems/input_system.rs +++ b/code/rust-sokoban-c03-02/src/systems/input_system.rs @@ -2,8 +2,8 @@ use crate::components::*; use crate::constants::*; use crate::resources::{InputQueue, Gameplay}; use ggez::event::KeyCode; -use specs::world::Index; -use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage}; +use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage}; + use std::collections::HashMap; pub struct InputSystem {} diff --git a/code/rust-sokoban-c03-02/src/systems/rendering_system.rs b/code/rust-sokoban-c03-02/src/systems/rendering_system.rs index 88d96af..bc19b2c 100644 --- a/code/rust-sokoban-c03-02/src/systems/rendering_system.rs +++ b/code/rust-sokoban-c03-02/src/systems/rendering_system.rs @@ -1,13 +1,13 @@ + use crate::components::*; -use crate::constants::TILE_WIDTH; use crate::resources::*; -use ggez::graphics; -use ggez::graphics::Color; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +use crate::constants::TILE_WIDTH; + +use ggez::{Context, graphics::{self, DrawParam, Image, Color}}; +use specs::{Join, ReadStorage, System, Read}; use glam::Vec2; -use ggez::Context; -use specs::{Join, Read, ReadStorage, System}; + + use std::time::Duration; pub struct RenderingSystem<'a> { diff --git a/code/rust-sokoban-c03-03/src/components.rs b/code/rust-sokoban-c03-03/src/components.rs index 78a8cf4..9f4f26d 100644 --- a/code/rust-sokoban-c03-03/src/components.rs +++ b/code/rust-sokoban-c03-03/src/components.rs @@ -1,6 +1,6 @@ use specs::{Component, NullStorage, VecStorage, World, WorldExt}; -use std::fmt; -use std::fmt::Display; + +use std::fmt::{self, Display}; // Components #[derive(Debug, Component, Clone, Copy)] diff --git a/code/rust-sokoban-c03-03/src/resources.rs b/code/rust-sokoban-c03-03/src/resources.rs index cb820a6..9eed6d1 100644 --- a/code/rust-sokoban-c03-03/src/resources.rs +++ b/code/rust-sokoban-c03-03/src/resources.rs @@ -2,8 +2,8 @@ use crate::audio::AudioStore; use crate::events::Event; use ggez::event::KeyCode; use specs::World; -use std::fmt; -use std::{fmt::Display, time::Duration}; + +use std::{fmt::{self, Display}, time::Duration}; // Resources #[derive(Default)] diff --git a/code/rust-sokoban-c03-03/src/systems/input_system.rs b/code/rust-sokoban-c03-03/src/systems/input_system.rs index 7a36c67..748b20b 100644 --- a/code/rust-sokoban-c03-03/src/systems/input_system.rs +++ b/code/rust-sokoban-c03-03/src/systems/input_system.rs @@ -3,8 +3,8 @@ use crate::constants::*; use crate::events::{EntityMoved, Event}; use crate::resources::{EventQueue, Gameplay, InputQueue}; use ggez::event::KeyCode; -use specs::world::Index; -use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage}; +use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage}; + use std::collections::HashMap; pub struct InputSystem {} diff --git a/code/rust-sokoban-c03-03/src/systems/rendering_system.rs b/code/rust-sokoban-c03-03/src/systems/rendering_system.rs index 88d96af..7cc86a1 100644 --- a/code/rust-sokoban-c03-03/src/systems/rendering_system.rs +++ b/code/rust-sokoban-c03-03/src/systems/rendering_system.rs @@ -1,15 +1,14 @@ + + use crate::components::*; use crate::constants::TILE_WIDTH; use crate::resources::*; -use ggez::graphics; -use ggez::graphics::Color; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; + +use ggez::{Context, graphics::{self, DrawParam, Image, Color}}; +use specs::{Join, ReadStorage, System, Read}; use glam::Vec2; -use ggez::Context; -use specs::{Join, Read, ReadStorage, System}; -use std::time::Duration; +use std::time::Duration; pub struct RenderingSystem<'a> { pub context: &'a mut Context, } diff --git a/code/rust-sokoban-c03-04/src/components.rs b/code/rust-sokoban-c03-04/src/components.rs index 78a8cf4..9f4f26d 100644 --- a/code/rust-sokoban-c03-04/src/components.rs +++ b/code/rust-sokoban-c03-04/src/components.rs @@ -1,6 +1,6 @@ use specs::{Component, NullStorage, VecStorage, World, WorldExt}; -use std::fmt; -use std::fmt::Display; + +use std::fmt::{self, Display}; // Components #[derive(Debug, Component, Clone, Copy)] diff --git a/code/rust-sokoban-c03-04/src/resources.rs b/code/rust-sokoban-c03-04/src/resources.rs index cb820a6..9eed6d1 100644 --- a/code/rust-sokoban-c03-04/src/resources.rs +++ b/code/rust-sokoban-c03-04/src/resources.rs @@ -2,8 +2,8 @@ use crate::audio::AudioStore; use crate::events::Event; use ggez::event::KeyCode; use specs::World; -use std::fmt; -use std::{fmt::Display, time::Duration}; + +use std::{fmt::{self, Display}, time::Duration}; // Resources #[derive(Default)] diff --git a/code/rust-sokoban-c03-04/src/systems/input_system.rs b/code/rust-sokoban-c03-04/src/systems/input_system.rs index 7a36c67..748b20b 100644 --- a/code/rust-sokoban-c03-04/src/systems/input_system.rs +++ b/code/rust-sokoban-c03-04/src/systems/input_system.rs @@ -3,8 +3,8 @@ use crate::constants::*; use crate::events::{EntityMoved, Event}; use crate::resources::{EventQueue, Gameplay, InputQueue}; use ggez::event::KeyCode; -use specs::world::Index; -use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage}; +use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage}; + use std::collections::HashMap; pub struct InputSystem {} diff --git a/code/rust-sokoban-c03-04/src/systems/rendering_system.rs b/code/rust-sokoban-c03-04/src/systems/rendering_system.rs index fc87f27..9b82b33 100644 --- a/code/rust-sokoban-c03-04/src/systems/rendering_system.rs +++ b/code/rust-sokoban-c03-04/src/systems/rendering_system.rs @@ -1,16 +1,16 @@ + + + use crate::components::*; -use crate::constants::TILE_WIDTH; use crate::resources::*; -use ggez::graphics; -use ggez::graphics::Color; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +use crate::constants::TILE_WIDTH; + +use ggez::{Context, graphics::{self, DrawParam, Image, Color, spritebatch::SpriteBatch}, timer}; +use specs::{Join, ReadStorage, System, Read}; use glam::Vec2; -use ggez::{timer, Context}; -use graphics::spritebatch::SpriteBatch; use itertools::Itertools; -use specs::{Join, Read, ReadStorage, System}; -use std::{collections::HashMap, time::Duration}; + +use std::{time::Duration, collections::HashMap}; pub struct RenderingSystem<'a> { pub context: &'a mut Context, diff --git a/code/rust-sokoban-c03-05/src/components.rs b/code/rust-sokoban-c03-05/src/components.rs index 78a8cf4..9f4f26d 100644 --- a/code/rust-sokoban-c03-05/src/components.rs +++ b/code/rust-sokoban-c03-05/src/components.rs @@ -1,6 +1,6 @@ use specs::{Component, NullStorage, VecStorage, World, WorldExt}; -use std::fmt; -use std::fmt::Display; + +use std::fmt::{self, Display}; // Components #[derive(Debug, Component, Clone, Copy)] diff --git a/code/rust-sokoban-c03-05/src/resources.rs b/code/rust-sokoban-c03-05/src/resources.rs index cb820a6..9eed6d1 100644 --- a/code/rust-sokoban-c03-05/src/resources.rs +++ b/code/rust-sokoban-c03-05/src/resources.rs @@ -2,8 +2,8 @@ use crate::audio::AudioStore; use crate::events::Event; use ggez::event::KeyCode; use specs::World; -use std::fmt; -use std::{fmt::Display, time::Duration}; + +use std::{fmt::{self, Display}, time::Duration}; // Resources #[derive(Default)] diff --git a/code/rust-sokoban-c03-05/src/systems/input_system.rs b/code/rust-sokoban-c03-05/src/systems/input_system.rs index 7a36c67..748b20b 100644 --- a/code/rust-sokoban-c03-05/src/systems/input_system.rs +++ b/code/rust-sokoban-c03-05/src/systems/input_system.rs @@ -3,8 +3,8 @@ use crate::constants::*; use crate::events::{EntityMoved, Event}; use crate::resources::{EventQueue, Gameplay, InputQueue}; use ggez::event::KeyCode; -use specs::world::Index; -use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage}; +use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage}; + use std::collections::HashMap; pub struct InputSystem {} diff --git a/code/rust-sokoban-c03-05/src/systems/rendering_system.rs b/code/rust-sokoban-c03-05/src/systems/rendering_system.rs index fc87f27..9b82b33 100644 --- a/code/rust-sokoban-c03-05/src/systems/rendering_system.rs +++ b/code/rust-sokoban-c03-05/src/systems/rendering_system.rs @@ -1,16 +1,16 @@ + + + use crate::components::*; -use crate::constants::TILE_WIDTH; use crate::resources::*; -use ggez::graphics; -use ggez::graphics::Color; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +use crate::constants::TILE_WIDTH; + +use ggez::{Context, graphics::{self, DrawParam, Image, Color, spritebatch::SpriteBatch}, timer}; +use specs::{Join, ReadStorage, System, Read}; use glam::Vec2; -use ggez::{timer, Context}; -use graphics::spritebatch::SpriteBatch; use itertools::Itertools; -use specs::{Join, Read, ReadStorage, System}; -use std::{collections::HashMap, time::Duration}; + +use std::{time::Duration, collections::HashMap}; pub struct RenderingSystem<'a> { pub context: &'a mut Context, diff --git a/code/rust-sokoban-c04-01/src/components.rs b/code/rust-sokoban-c04-01/src/components.rs index 78a8cf4..9f4f26d 100644 --- a/code/rust-sokoban-c04-01/src/components.rs +++ b/code/rust-sokoban-c04-01/src/components.rs @@ -1,6 +1,6 @@ use specs::{Component, NullStorage, VecStorage, World, WorldExt}; -use std::fmt; -use std::fmt::Display; + +use std::fmt::{self, Display}; // Components #[derive(Debug, Component, Clone, Copy)] diff --git a/code/rust-sokoban-c04-01/src/resources.rs b/code/rust-sokoban-c04-01/src/resources.rs index cb820a6..9eed6d1 100644 --- a/code/rust-sokoban-c04-01/src/resources.rs +++ b/code/rust-sokoban-c04-01/src/resources.rs @@ -2,8 +2,8 @@ use crate::audio::AudioStore; use crate::events::Event; use ggez::event::KeyCode; use specs::World; -use std::fmt; -use std::{fmt::Display, time::Duration}; + +use std::{fmt::{self, Display}, time::Duration}; // Resources #[derive(Default)] diff --git a/code/rust-sokoban-c04-01/src/systems/input_system.rs b/code/rust-sokoban-c04-01/src/systems/input_system.rs index 7a36c67..748b20b 100644 --- a/code/rust-sokoban-c04-01/src/systems/input_system.rs +++ b/code/rust-sokoban-c04-01/src/systems/input_system.rs @@ -3,8 +3,8 @@ use crate::constants::*; use crate::events::{EntityMoved, Event}; use crate::resources::{EventQueue, Gameplay, InputQueue}; use ggez::event::KeyCode; -use specs::world::Index; -use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage}; +use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage}; + use std::collections::HashMap; pub struct InputSystem {} diff --git a/code/rust-sokoban-c04-01/src/systems/rendering_system.rs b/code/rust-sokoban-c04-01/src/systems/rendering_system.rs index f7bac6a..b490f36 100644 --- a/code/rust-sokoban-c04-01/src/systems/rendering_system.rs +++ b/code/rust-sokoban-c04-01/src/systems/rendering_system.rs @@ -1,17 +1,17 @@ + + + + use crate::components::*; -use crate::constants::TILE_WIDTH; use crate::resources::*; -use ggez::graphics; -use ggez::graphics::Color; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; -use glam::Vec2; -use ggez::{timer, Context}; +use crate::constants::TILE_WIDTH; -use graphics::spritebatch::SpriteBatch; +use ggez::{Context, graphics::{self, DrawParam, Image, Color, spritebatch::SpriteBatch}, timer}; +use specs::{Join, ReadStorage, System, Read}; +use glam::Vec2; use itertools::Itertools; -use specs::{Join, Read, ReadStorage, System}; -use std::{collections::HashMap, time::Duration}; + +use std::{time::Duration, collections::HashMap}; pub struct RenderingSystem<'a> { pub context: &'a mut Context, From 5eb28887f571e159d68e323d77c67853f5865aac Mon Sep 17 00:00:00 2001 From: Olivia Date: Sun, 21 Nov 2021 20:08:45 +0000 Subject: [PATCH 2/2] Style fix: imports on one line in main --- code/rust-sokoban-c01-03/src/main.rs | 16 +++++----- code/rust-sokoban-c01-04/src/main.rs | 10 +++--- code/rust-sokoban-c02-01/src/main.rs | 10 +++--- code/rust-sokoban-c02-02/src/main.rs | 14 ++++---- code/rust-sokoban-c02-03/src/main.rs | 32 +++++++++---------- code/rust-sokoban-c02-04/src/main.rs | 8 ++--- code/rust-sokoban-c02-05/src/main.rs | 8 ++--- .../src/systems/input_system.rs | 4 +-- code/rust-sokoban-c03-01/src/main.rs | 8 ++--- code/rust-sokoban-c03-02/src/main.rs | 8 ++--- code/rust-sokoban-c03-03/src/main.rs | 8 ++--- .../src/systems/rendering_system.rs | 1 + code/rust-sokoban-c03-04/src/main.rs | 8 ++--- code/rust-sokoban-c03-05/src/main.rs | 8 ++--- code/rust-sokoban-c04-01/src/main.rs | 8 ++--- 15 files changed, 76 insertions(+), 75 deletions(-) diff --git a/code/rust-sokoban-c01-03/src/main.rs b/code/rust-sokoban-c01-03/src/main.rs index 4773641..68c1530 100644 --- a/code/rust-sokoban-c01-03/src/main.rs +++ b/code/rust-sokoban-c01-03/src/main.rs @@ -1,11 +1,11 @@ -use ggez; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +// Rust sokoban +// main.rs + + + use ggez::{conf, event, Context, GameResult}; -use specs::{ - join::Join, Builder, Component, ReadStorage, RunNow, System, VecStorage, World, WorldExt, -}; +use specs::{Builder, Component, VecStorage, World, WorldExt}; + use std::path; @@ -52,7 +52,7 @@ impl event::EventHandler for Game { Ok(()) } - fn draw(&mut self, context: &mut Context) -> GameResult { + fn draw(&mut self, _context: &mut Context) -> GameResult { Ok(()) } } diff --git a/code/rust-sokoban-c01-04/src/main.rs b/code/rust-sokoban-c01-04/src/main.rs index 1fc48a3..7f82725 100644 --- a/code/rust-sokoban-c01-04/src/main.rs +++ b/code/rust-sokoban-c01-04/src/main.rs @@ -1,9 +1,9 @@ -use ggez; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +// Rust sokoban +// main.rs + use glam::Vec2; -use ggez::{conf, event, Context, GameResult}; +use ggez::{conf, event, Context, GameResult, + graphics::{self, DrawParam, Image}}; use specs::{ join::Join, Builder, Component, ReadStorage, RunNow, System, VecStorage, World, WorldExt, }; diff --git a/code/rust-sokoban-c02-01/src/main.rs b/code/rust-sokoban-c02-01/src/main.rs index c0ede9e..561e0f2 100644 --- a/code/rust-sokoban-c02-01/src/main.rs +++ b/code/rust-sokoban-c02-01/src/main.rs @@ -1,9 +1,9 @@ -use ggez; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +// Rust sokoban +// main.rs + use glam::Vec2; -use ggez::{conf, event, Context, GameResult}; +use ggez::{conf, event, Context, GameResult, + graphics::{self, DrawParam, Image}}; use specs::{ join::Join, Builder, Component, ReadStorage, RunNow, System, VecStorage, World, WorldExt, }; diff --git a/code/rust-sokoban-c02-02/src/main.rs b/code/rust-sokoban-c02-02/src/main.rs index 0f3b792..cf0dd0e 100644 --- a/code/rust-sokoban-c02-02/src/main.rs +++ b/code/rust-sokoban-c02-02/src/main.rs @@ -1,12 +1,12 @@ -use ggez; -use ggez::event::{KeyCode, KeyMods}; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +// Rust sokoban +// main.rs + use glam::Vec2; -use ggez::{conf, event, Context, GameResult}; +use ggez::{conf, Context, GameResult, + event::{self, KeyCode, KeyMods}, + graphics::{self, DrawParam, Image}}; use specs::{ - join::Join, Builder, Component, Read, ReadStorage, RunNow, System, VecStorage, World, WorldExt, + join::Join, Builder, Component, ReadStorage, RunNow, System, VecStorage, World, WorldExt, Write, WriteStorage, }; diff --git a/code/rust-sokoban-c02-03/src/main.rs b/code/rust-sokoban-c02-03/src/main.rs index 3823466..fda8fd8 100644 --- a/code/rust-sokoban-c02-03/src/main.rs +++ b/code/rust-sokoban-c02-03/src/main.rs @@ -1,19 +1,19 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +// Rust sokoban +// main.rs + + + use glam::Vec2; -use ggez::{conf, event, Context, GameResult}; -use specs::world::Index; -use specs::Entities; -use specs::NullStorage; -use specs::WriteStorage; +use ggez::{ + conf, Context, GameResult, + event::{self, KeyCode, KeyMods}, + graphics::{self, DrawParam, Image}}; use specs::{ - join::Join, Builder, Component, Read, ReadStorage, RunNow, System, VecStorage, World, WorldExt, - Write, + join::Join, Builder, Component, ReadStorage, RunNow, + System, VecStorage, World, WorldExt, + Write, WriteStorage, NullStorage, Entities, world::Index }; + use std::collections::HashMap; use std::path; @@ -129,11 +129,11 @@ impl<'a> System<'a> for InputSystem { // Get the first key pressed if let Some(key) = input_queue.keys_pressed.pop() { // get all the movables and immovables - let mut mov: HashMap<(u8, u8), Index> = (&entities, &movables, &positions) + let mov: HashMap<(u8, u8), Index> = (&entities, &movables, &positions) .join() .map(|t| ((t.2.x, t.2.y), t.0.id())) .collect::>(); - let mut immov: HashMap<(u8, u8), Index> = (&entities, &immovables, &positions) + let immov: HashMap<(u8, u8), Index> = (&entities, &immovables, &positions) .join() .map(|t| ((t.2.x, t.2.y), t.0.id())) .collect::>(); @@ -171,7 +171,7 @@ impl<'a> System<'a> for InputSystem { // if it exists, we need to stop and not move anything // if it doesn't exist, we stop because we found a gap match immov.get(&pos) { - Some(id) => to_move.clear(), + Some(_id) => to_move.clear(), None => break, } } diff --git a/code/rust-sokoban-c02-04/src/main.rs b/code/rust-sokoban-c02-04/src/main.rs index dbd784d..34f10b7 100644 --- a/code/rust-sokoban-c02-04/src/main.rs +++ b/code/rust-sokoban-c02-04/src/main.rs @@ -1,7 +1,7 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, Context, GameResult}; +// Rust sokoban +// main.rs + +use ggez::{conf, event::{self, KeyCode, KeyMods}, Context, GameResult}; use specs::{RunNow, World, WorldExt}; use std::path; diff --git a/code/rust-sokoban-c02-05/src/main.rs b/code/rust-sokoban-c02-05/src/main.rs index c692e20..327da35 100644 --- a/code/rust-sokoban-c02-05/src/main.rs +++ b/code/rust-sokoban-c02-05/src/main.rs @@ -1,7 +1,7 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, Context, GameResult}; +// Rust sokoban +// main.rs + +use ggez::{conf, event::{self, KeyCode, KeyMods}, Context, GameResult}; use specs::{RunNow, World, WorldExt}; use std::path; diff --git a/code/rust-sokoban-c02-05/src/systems/input_system.rs b/code/rust-sokoban-c02-05/src/systems/input_system.rs index 292988f..74ef39a 100644 --- a/code/rust-sokoban-c02-05/src/systems/input_system.rs +++ b/code/rust-sokoban-c02-05/src/systems/input_system.rs @@ -1,8 +1,8 @@ use crate::components::*; use crate::constants::*; use crate::resources::{InputQueue, Gameplay}; -use specs::{world::Index, event::KeyCode}; -use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage}; +use ggez::event::KeyCode; +use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage}; use std::collections::HashMap; diff --git a/code/rust-sokoban-c03-01/src/main.rs b/code/rust-sokoban-c03-01/src/main.rs index 30ed508..8336960 100644 --- a/code/rust-sokoban-c03-01/src/main.rs +++ b/code/rust-sokoban-c03-01/src/main.rs @@ -1,7 +1,7 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, Context, GameResult}; +// Rust sokoban +// main.rs + +use ggez::{conf, event::{self, KeyCode, KeyMods}, Context, GameResult}; use specs::{RunNow, World, WorldExt}; use std::path; diff --git a/code/rust-sokoban-c03-02/src/main.rs b/code/rust-sokoban-c03-02/src/main.rs index af664ad..6fda229 100644 --- a/code/rust-sokoban-c03-02/src/main.rs +++ b/code/rust-sokoban-c03-02/src/main.rs @@ -1,8 +1,8 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, timer, Context, GameResult}; +// Rust sokoban +// main.rs +use ggez::{conf, event::{self, KeyCode, KeyMods}, timer, Context, GameResult}; use specs::{RunNow, World, WorldExt}; + use std::path; mod components; diff --git a/code/rust-sokoban-c03-03/src/main.rs b/code/rust-sokoban-c03-03/src/main.rs index bbd40c3..47b6b8f 100644 --- a/code/rust-sokoban-c03-03/src/main.rs +++ b/code/rust-sokoban-c03-03/src/main.rs @@ -1,8 +1,8 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, timer, Context, GameResult}; +// Rust sokoban +// main.rs +use ggez::{conf, event::{self, KeyCode, KeyMods}, timer, Context, GameResult}; use specs::{RunNow, World, WorldExt}; + use std::path; mod audio; diff --git a/code/rust-sokoban-c03-03/src/systems/rendering_system.rs b/code/rust-sokoban-c03-03/src/systems/rendering_system.rs index 7cc86a1..50be23a 100644 --- a/code/rust-sokoban-c03-03/src/systems/rendering_system.rs +++ b/code/rust-sokoban-c03-03/src/systems/rendering_system.rs @@ -9,6 +9,7 @@ use specs::{Join, ReadStorage, System, Read}; use glam::Vec2; use std::time::Duration; + pub struct RenderingSystem<'a> { pub context: &'a mut Context, } diff --git a/code/rust-sokoban-c03-04/src/main.rs b/code/rust-sokoban-c03-04/src/main.rs index bbd40c3..47b6b8f 100644 --- a/code/rust-sokoban-c03-04/src/main.rs +++ b/code/rust-sokoban-c03-04/src/main.rs @@ -1,8 +1,8 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, timer, Context, GameResult}; +// Rust sokoban +// main.rs +use ggez::{conf, event::{self, KeyCode, KeyMods}, timer, Context, GameResult}; use specs::{RunNow, World, WorldExt}; + use std::path; mod audio; diff --git a/code/rust-sokoban-c03-05/src/main.rs b/code/rust-sokoban-c03-05/src/main.rs index bbd40c3..47b6b8f 100644 --- a/code/rust-sokoban-c03-05/src/main.rs +++ b/code/rust-sokoban-c03-05/src/main.rs @@ -1,8 +1,8 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, timer, Context, GameResult}; +// Rust sokoban +// main.rs +use ggez::{conf, event::{self, KeyCode, KeyMods}, timer, Context, GameResult}; use specs::{RunNow, World, WorldExt}; + use std::path; mod audio; diff --git a/code/rust-sokoban-c04-01/src/main.rs b/code/rust-sokoban-c04-01/src/main.rs index bbd40c3..47b6b8f 100644 --- a/code/rust-sokoban-c04-01/src/main.rs +++ b/code/rust-sokoban-c04-01/src/main.rs @@ -1,8 +1,8 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, timer, Context, GameResult}; +// Rust sokoban +// main.rs +use ggez::{conf, event::{self, KeyCode, KeyMods}, timer, Context, GameResult}; use specs::{RunNow, World, WorldExt}; + use std::path; mod audio;