diff --git a/generic-queue/Cargo.toml b/generic-queue/Cargo.toml index 53c2ebf..3ca8f6e 100644 --- a/generic-queue/Cargo.toml +++ b/generic-queue/Cargo.toml @@ -2,5 +2,6 @@ name = "generic-queue" version = "0.1.0" authors = ["You "] +edition = "2018" [dependencies] diff --git a/generic-queue/src/lib.rs b/generic-queue/src/lib.rs index d8ae4d6..224b6cd 100644 --- a/generic-queue/src/lib.rs +++ b/generic-queue/src/lib.rs @@ -1,10 +1,13 @@ +#![warn(rust_2018_idioms)] +#![allow(elided_lifetimes_in_paths)] + pub struct Queue { older: Vec, younger: Vec } impl Queue { - pub fn new() -> Queue { + pub fn new() -> Self { Queue { older: Vec::new(), younger: Vec::new() } } @@ -85,6 +88,6 @@ fn test_generic() { q.push("CAD"); // apparently a Queue<&'static str> r.push(0.74); // apparently a Queue - q.push("BTC"); // Bitcoins per USD, 2017-5 - r.push(2737.7); // Rust fails to detect irrational exuberance + q.push("BTC"); // Bitcoins per USD, 2019-6 + r.push(13764.0); // Rust fails to detect irrational exuberance }