From: Ralf Jung Date: Sun, 6 Mar 2016 10:54:56 +0000 (+0100) Subject: Merge pull request #6 from stefandisch/master X-Git-Url: https://git.ralfj.de/rust-101.git/commitdiff_plain/45ec4d50797cdac0edb7c4653e71357fa6ab54a1?hp=20c3754739514b710a2e6744c9fd43bcb83c4706 Merge pull request #6 from stefandisch/master Removed warnings when using rust 1.7.0 --- diff --git a/src/main.rs b/src/main.rs index 9b7132d..69d9ca7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,7 +37,7 @@ // --------------- // // You will need to have Rust installed, of course. It is available for download on -// [the Rust website](https://www.rust-lang.org/). Make sure you get at least version 1.2. +// [the Rust website](https://www.rust-lang.org/). Make sure you get at least version 1.3. // More detailed installation instructions are provided in // [the second chapter of The Book](https://doc.rust-lang.org/stable/book/installing-rust.html). // This will also install `cargo`, the tool responsible for building rust projects (or *crates*). diff --git a/workspace/src/part03.rs b/workspace/src/part03.rs index e3f16ae..3840156 100644 --- a/workspace/src/part03.rs +++ b/workspace/src/part03.rs @@ -57,7 +57,7 @@ pub fn main() { // Notice that I called the function on `SomethingOrNothing` `print2` to disambiguate from the `print` defined previously. // // *Hint*: There is a macro `print!` for printing without appending a newline. -trait Print { +pub trait Print { /* Add things here */ } impl SomethingOrNothing { diff --git a/workspace/src/part15.rs b/workspace/src/part15.rs index 1a6873e..6982579 100644 --- a/workspace/src/part15.rs +++ b/workspace/src/part15.rs @@ -3,6 +3,7 @@ use std::sync::{Arc, Mutex}; use std::thread; +use std::time::Duration; // The derived `Clone` implementation will clone the `Arc`, so all clones will actually talk about the same counter. @@ -36,7 +37,7 @@ pub fn main() { let counter1 = counter.clone(); let handle1 = thread::spawn(move || { for _ in 0..10 { - thread::sleep_ms(15); + thread::sleep(Duration::from_millis(15)); counter1.increment(2); } }); @@ -45,14 +46,14 @@ pub fn main() { let counter2 = counter.clone(); let handle2 = thread::spawn(move || { for _ in 0..10 { - thread::sleep_ms(20); + thread::sleep(Duration::from_millis(20)); counter2.increment(3); } }); // Now we watch the threads working on the counter. for _ in 0..50 { - thread::sleep_ms(5); + thread::sleep(Duration::from_millis(5)); println!("Current value: {}", counter.get()); }