Skip to content

Commit

Permalink
Update Rust Edition (#1)
Browse files Browse the repository at this point in the history
* Update version

* Fix clippy errors
  • Loading branch information
luizdepra authored Jan 25, 2022
1 parent ec0ee7a commit dd1529e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 49 deletions.
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion devkit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["sn-50", "fantasy", "console", "computer"]
categories = ["games", "game-development", "game-engines"]
license = "MIT"
readme = "README.md"
edition = "2018"
edition = "2021"

[dependencies]
tinlib = { version = "0.1.0", path = "../tinlib" }
4 changes: 2 additions & 2 deletions tinlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["sn-50", "fantasy", "console", "computer"]
categories = ["games", "game-development", "game-engines"]
license = "MIT"
readme = "README.md"
edition = "2018"
edition = "2021"

[dependencies]
log = "0.4.8"
log = "0.4.14"
21 changes: 1 addition & 20 deletions tinlib/src/graphic/color.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Color implementation and manipulation.

/// A color representation with red, green and blue values.
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Default, Clone, Copy, PartialEq)]
pub struct Color {
red: u8,
green: u8,
Expand Down Expand Up @@ -40,16 +40,6 @@ impl Color {
}
}

impl Default for Color {
fn default() -> Self {
Self {
red: 0,
green: 0,
blue: 0,
}
}
}

impl From<(u8, u8, u8)> for Color {
fn from(value: (u8, u8, u8)) -> Self {
Self::new(value.0, value.1, value.2)
Expand Down Expand Up @@ -93,15 +83,6 @@ mod tests {
assert_eq!(color.blue(), 3);
}

#[test]
fn test_color_default() {
let color = Color::default();

assert_eq!(color.red, 0);
assert_eq!(color.green, 0);
assert_eq!(color.blue, 0);
}

#[test]
fn test_color_from_tuple() {
let tuple = (1u8, 2u8, 3u8);
Expand Down
7 changes: 1 addition & 6 deletions tinlib/src/machine/input.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
#[derive(Default)]
pub struct Input;

impl Default for Input {
fn default() -> Self {
Self {}
}
}
12 changes: 1 addition & 11 deletions tinlib/src/machine/ram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::machine::input::Input;
use crate::map::Map;

/// The machine RAM representation.
#[derive(Default)]
pub struct RAM<'map> {
code: Code,
map: Map<'map>,
Expand Down Expand Up @@ -41,14 +42,3 @@ impl<'map> RAM<'map> {
&mut self.input
}
}

impl<'map> Default for RAM<'map> {
// Creates a new RAM.
fn default() -> Self {
Self {
code: Code::default(),
map: Map::default(),
input: Input::default(),
}
}
}

0 comments on commit dd1529e

Please sign in to comment.