From cac08e302995e25c4b5d99fd98a616d1207bae54 Mon Sep 17 00:00:00 2001 From: "Tim \"S.D.Eagle\" Zeitz" Date: Fri, 7 Dec 2018 14:20:17 +0100 Subject: [PATCH] upgrade to rust 2018 and some other fixes --- Cargo.lock | 12 ++++++------ Cargo.toml | 3 ++- src/bin/compare_vector.rs | 1 - src/bin/decode_vector.rs | 1 - src/bin/encode_vector.rs | 1 - src/bin/example.rs | 2 -- src/lib.rs | 2 -- src/time.rs | 8 +++----- 8 files changed, 11 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bc66e43..53a2d25 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,11 +1,11 @@ [[package]] name = "libc" -version = "0.2.43" +version = "0.2.44" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "redox_syscall" -version = "0.1.40" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -20,8 +20,8 @@ name = "time" version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -45,8 +45,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" -"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" +"checksum libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)" = "10923947f84a519a45c8fefb7dd1b3e8c08747993381adee176d7a82b4195311" +"checksum redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "679da7508e9a6390aeaf7fbd02a800fdc64b73fe2204dd2c8ae66d22d9d5ad5d" "checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" diff --git a/Cargo.toml b/Cargo.toml index efe5553..344beb8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "stud-rust-base" version = "0.1.0" authors = ["Tim Zeitz "] +edition = '2018' [dependencies] -time = "0.1.40" +time = "^0.1.40" diff --git a/src/bin/compare_vector.rs b/src/bin/compare_vector.rs index 5d42c18..2f566ed 100644 --- a/src/bin/compare_vector.rs +++ b/src/bin/compare_vector.rs @@ -1,4 +1,3 @@ -extern crate stud_rust_base; use stud_rust_base::{io::*, cli::CliErr}; use std::{env, fmt::Display, error::Error}; diff --git a/src/bin/decode_vector.rs b/src/bin/decode_vector.rs index 691a7a0..4dca2e7 100644 --- a/src/bin/decode_vector.rs +++ b/src/bin/decode_vector.rs @@ -1,4 +1,3 @@ -extern crate stud_rust_base; use stud_rust_base::{io::*, cli::CliErr}; use std::{env, error::Error}; diff --git a/src/bin/encode_vector.rs b/src/bin/encode_vector.rs index c399669..a51a63a 100644 --- a/src/bin/encode_vector.rs +++ b/src/bin/encode_vector.rs @@ -1,4 +1,3 @@ -extern crate stud_rust_base; use stud_rust_base::{io::*, cli::CliErr}; use std::{env, error::Error}; diff --git a/src/bin/example.rs b/src/bin/example.rs index c0dbaf7..f8e9434 100644 --- a/src/bin/example.rs +++ b/src/bin/example.rs @@ -1,5 +1,3 @@ -extern crate stud_rust_base; - use stud_rust_base::{ types::*, io::*, diff --git a/src/lib.rs b/src/lib.rs index 85f3191..d0ab4df 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,5 @@ //! A small base framework for route planning student projects. -extern crate time as time_crate; - pub mod cli; pub mod index_heap; pub mod io; diff --git a/src/time.rs b/src/time.rs index 8a3843c..687f3e4 100644 --- a/src/time.rs +++ b/src/time.rs @@ -1,15 +1,13 @@ //! This module contains a few utilities to measure how long executing algorithms takes. //! It utilizes the `time` crate. -use time_crate as time; - /// This function will measure how long it takes to execute the given lambda, /// print the time and return the result of the lambda. pub fn report_time Out>(name: &str, f: F) -> Out { let start = time::now(); - println!("starting {}", name); + eprintln!("starting {}", name); let res = f(); - println!("done {} - took: {}", name, (time::now() - start)); + eprintln!("done {} - took: {}", name, (time::now() - start)); res } @@ -46,7 +44,7 @@ impl Timer { /// Print the passed time in ms since the timer was started pub fn report_passed_ms(&self) { - println!("{}ms", (time::now() - self.start).num_milliseconds()); + eprintln!("{}ms", (time::now() - self.start).num_milliseconds()); } /// Return the number of ms passed since the timer was started as a `i64` -- 2.34.1