diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2018-08-11 16:59:15 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2018-08-11 16:59:15 +0200 |
commit | 57f412d73a151f7a4fa35feaf249808dcbe5b5dc (patch) | |
tree | 219aebf5db4b9c621a4f5bcb86b12a8033bda353 /src/entities | |
parent | 092eb4685e9073b046c98371ab15f85156426d15 (diff) |
Clippy-suggested improvements
Diffstat (limited to 'src/entities')
-rw-r--r-- | src/entities/bug.rs | 7 | ||||
-rw-r--r-- | src/entities/home.rs | 5 |
2 files changed, 3 insertions, 9 deletions
diff --git a/src/entities/bug.rs b/src/entities/bug.rs index f64669d..b5e31c7 100644 --- a/src/entities/bug.rs +++ b/src/entities/bug.rs @@ -13,13 +13,10 @@ const SPEED: f64 = 175.; impl Bug { pub fn new(x: f64, y: f64) -> Bug { - let pos = Vec2d { - x: x, - y: y - }; + let pos = Vec2d::new(x, y); let pos_unit = pos.unit(); Bug { - pos: pos, + pos, rotation: (-pos).angle(), velocity: -pos_unit * SPEED, alive: true diff --git a/src/entities/home.rs b/src/entities/home.rs index 2839f5d..5666a75 100644 --- a/src/entities/home.rs +++ b/src/entities/home.rs @@ -12,10 +12,7 @@ pub struct Home { impl Home { pub fn new(x: f64, y: f64) -> Home { Home { - pos: Vec2d { - x: x, - y: y - }, + pos: Vec2d::new(x, y), animation_time: 0., sprite: SpriteId::Sleepypug1 } |