# HG changeset patch # User dermetfan # Date 1440432794 -7200 # Mon Aug 24 18:13:14 2015 +0200 # Node ID 84a1506635392306f8ae14cff732514c8259575e # Parent 610c0c457c814dc7921b4f70362979611793be0b added clippy, added default.nix, minor code changes diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -2,28 +2,47 @@ name = "cursedlife" version = "0.0.1" dependencies = [ - "getopts 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "ncurses 5.73.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "gcc" -version = "0.3.8" +name = "advapi32-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clippy" +version = "0.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "getopts" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "kernel32-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "libc" -version = "0.1.8" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -31,7 +50,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -39,23 +58,36 @@ version = "5.73.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" -version = "0.1.26" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,11 @@ [package] name = "cursedlife" version = "0.0.1" -authors = ["dermetfan"] +authors = ["dermetfan "] [dependencies] ncurses = "5.73" time = "0.1" rand = "0.3" getopts = "0.2" +clippy = "0.0" diff --git a/default.nix b/default.nix new file mode 100644 --- /dev/null +++ b/default.nix @@ -0,0 +1,10 @@ +with import { }; +with rustUnstable; +with ncurses; + +buildRustPackage { + name = "cursedlife"; + src = ./.; + buildInputs = [ ncurses ]; + depsSha256 = ""; +} diff --git a/src/main.rs b/src/main.rs --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,9 @@ // terms of the Do What The Fuck You Want To Public License, Version 2, // as published by Sam Hocevar. See the LICENSE file for more details. +#![feature(plugin)] +#![plugin(clippy)] + extern crate ncurses; extern crate time; extern crate rand; @@ -16,7 +19,7 @@ const BG_COLORS: i16 = 0; const CURSOR_COLORS: i16 = 1; - let init_ncurses = || { + fn init_ncurses() { initscr(); cbreak(); noecho(); @@ -26,16 +29,16 @@ start_color(); init_pair(BG_COLORS, COLOR_WHITE, COLOR_BLACK); init_pair(CURSOR_COLORS, COLOR_BLACK, COLOR_YELLOW); - }; - let end_ncurses = || { + } + fn end_ncurses() { echo(); nocbreak(); endwin(); }; - let exit_with_msg = |code: i32, msg: &str| { + fn exit_with_msg(code: i32, msg: &str) { println!("{}", msg); std::process::exit(code); - }; + } const ARG_HELP: &'static str = "help"; const ARG_ROWS: &'static str = "rows";