Skip to content

Commit 807b796

Browse files
committed
generic-queue: Update for Rust 2018.
1 parent 4e2e6c3 commit 807b796

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

generic-queue/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
name = "generic-queue"
33
version = "0.1.0"
44
authors = ["You <[email protected]>"]
5+
edition = "2018"
56

67
[dependencies]

generic-queue/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
#![warn(rust_2018_idioms)]
2+
#![allow(elided_lifetimes_in_paths)]
3+
14
pub struct Queue<T> {
25
older: Vec<T>,
36
younger: Vec<T>
47
}
58

69
impl<T> Queue<T> {
7-
pub fn new() -> Queue<T> {
10+
pub fn new() -> Self {
811
Queue { older: Vec::new(), younger: Vec::new() }
912
}
1013

@@ -85,6 +88,6 @@ fn test_generic() {
8588
q.push("CAD"); // apparently a Queue<&'static str>
8689
r.push(0.74); // apparently a Queue<f64>
8790

88-
q.push("BTC"); // Bitcoins per USD, 2017-5
89-
r.push(2737.7); // Rust fails to detect irrational exuberance
91+
q.push("BTC"); // Bitcoins per USD, 2019-6
92+
r.push(13764.0); // Rust fails to detect irrational exuberance
9093
}

0 commit comments

Comments
 (0)