From cd713761ab6545f1f35f2e701ccb3b929fb1bbfa Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius Date: Sun, 29 Jul 2018 19:14:39 +0300 Subject: [PATCH 1/3] Update Travis to rust matrix to include versions that have ..= --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57fec8a..79751cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,11 +15,11 @@ addons: matrix: include: - os: linux - rust: 1.23.0 + rust: 1.26.0 - os: linux - rust: 1.25.0 + rust: 1.27.0 - os: osx - rust: 1.25.0 + rust: 1.27.0 - os: linux rust: beta - os: linux From e9a775669363274ccf2cfab62d394dcad4baccaf Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius Date: Sun, 29 Jul 2018 19:14:58 +0300 Subject: [PATCH 2/3] Use ..= in canvas.rs --- src/canvas.rs | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/canvas.rs b/src/canvas.rs index 316c5c3..5f83be6 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -10,16 +10,10 @@ //! let bools = c.to_bools(); use std::cmp::max; -use std::ops::Range; use types::{Color, EcLevel, Version}; use cast::As; -// TODO remove this after `p..=q` becomes stable. See rust-lang/rust#28237. -fn range_inclusive(from: i16, to: i16) -> Range { - from..(to + 1) -} - //------------------------------------------------------------------------------ //{{{ Modules @@ -177,8 +171,8 @@ mod basic_canvas_tests { fn test_debug_str() { let mut c = Canvas::new(Version::Normal(1), EcLevel::L); - for i in 3i16..20 { - for j in 3i16..20 { + for i in 3_i16..20 { + for j in 3_i16..20 { *c.get_mut(i, j) = match ((i * 3) ^ j) % 5 { 0 => Module::Empty, 1 => Module::Masked(Color::Light), @@ -227,8 +221,8 @@ impl Canvas { fn draw_finder_pattern_at(&mut self, x: i16, y: i16) { let (dx_left, dx_right) = if x >= 0 { (-3, 4) } else { (-4, 3) }; let (dy_top, dy_bottom) = if y >= 0 { (-3, 4) } else { (-4, 3) }; - for j in range_inclusive(dy_top, dy_bottom) { - for i in range_inclusive(dx_left, dx_right) { + for j in dy_top..=dy_bottom { + for i in dx_left..=dx_right { self.put( x + i, y + j, @@ -330,8 +324,8 @@ impl Canvas { if self.get(x, y) != Module::Empty { return; } - for j in range_inclusive(-2, 2) { - for i in range_inclusive(-2, 2) { + for j in -2..=2 { + for i in -2..=2 { self.put( x + i, y + j, @@ -567,12 +561,12 @@ impl Canvas { if y1 == y2 { // Horizontal line. - for x in range_inclusive(x1, x2) { + for x in x1..=x2 { self.put(x, y1, if x % 2 == 0 { color_even } else { color_odd }); } } else { // Vertical line. - for y in range_inclusive(y1, y2) { + for y in y1..=y2 { self.put(x1, y, if y % 2 == 0 { color_even } else { color_odd }); } } @@ -1472,7 +1466,7 @@ impl Canvas { }; for (i, b) in codewords.iter().enumerate() { let bits_end = if i == last_word { 4 } else { 0 }; - 'outside: for j in range_inclusive(bits_end, 7).rev() { + 'outside: for j in (bits_end..=7).rev() { let color = if (*b & (1 << j)) == 0 { Color::Light } else { @@ -2134,7 +2128,7 @@ mod penalty_tests { ]; let mut c = Canvas::new(Version::Micro(4), EcLevel::Q); - for i in 0i16..17 { + for i in 0_i16..17 { c.put(i, -1, HORIZONTAL_SIDE[i as usize]); c.put(-1, i, VERTICAL_SIDE[i as usize]); } From 5329a7ec180f2bc175bdbf1b4d9d223b5e6726da Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius Date: Sun, 29 Jul 2018 19:21:24 +0300 Subject: [PATCH 3/3] Bump the crate version as min Rust version now is 1.26.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index eab8082..7bcc272 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "qrcode" description = "QR code encoder in Rust" license = "MIT / Apache-2.0" -version = "0.7.0" +version = "0.8.0" authors = ["kennytm "] keywords = ["qrcode"] repository = "https://github.com/kennytm/qrcode-rust"