diff --git a/src/canvas.rs b/src/canvas.rs index 55a6566..cb20a91 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -142,7 +142,7 @@ impl Canvas { /// negative coordinates will wrap around. pub fn get_mut(&mut self, x: i16, y: i16) -> &mut Module { let index = self.coords_to_index(x, y); - self.modules.get_mut(index) + self.modules.index_mut(&index) } /// Sets the color of a module at the given coordinates. For convenience, @@ -185,7 +185,7 @@ mod basic_canvas_tests { 2 => Dark, 3 => LightUnmasked, 4 => DarkUnmasked, - _ => fail!(), + _ => panic!(), }); } } @@ -1348,7 +1348,7 @@ impl Canvas { LargeCheckerboard => 0b01, Diamonds => 0b10, Meadow => 0b11, - _ => fail!("Unsupported mask pattern in Micro QR code"), + _ => panic!("Unsupported mask pattern in Micro QR code"), }; let symbol_number = match (a, self.ec_level) { (1, L) => 0b000, @@ -1359,7 +1359,7 @@ impl Canvas { (4, L) => 0b101, (4, M) => 0b110, (4, Q) => 0b111, - _ => fail!("Unsupported version/ec_level combination in Micro QR code"), + _ => panic!("Unsupported version/ec_level combination in Micro QR code"), }; let simple_format_number = symbol_number << 2 | micro_pattern_number; FORMAT_INFOS_MICRO_QR[simple_format_number] diff --git a/src/ec.rs b/src/ec.rs index e47bbfd..3563344 100644 --- a/src/ec.rs +++ b/src/ec.rs @@ -8,7 +8,7 @@ use types::{QrResult, QrVersion, ErrorCorrectionLevel}; /// Creates the error correction code in N bytes. /// /// This method only supports computing the error-correction code up to -/// 69 bytes. Longer blocks will result in failure. +/// 69 bytes. Longer blocks will result in task panic. /// /// This method treats the data as a polynomial of the form /// (a[0] xm+n + a[1] xm+n-1 + … + a[m] xn) in diff --git a/src/lib.rs b/src/lib.rs index 7c82579..fa2bfa0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,7 +6,7 @@ //! //! let code = QrCode::new(b"Some content here."); //! match code { -//! Err(err) => fail!("Failed to encode the QR code: {}", err), +//! Err(err) => panic!("Failed to encode the QR code: {}", err), //! Ok(code) => { //! for y in range(0, code.width()) { //! for x in range(0, code.width()) { @@ -20,7 +20,7 @@ #![unstable] #![feature(slicing_syntax)] -#![feature(while_let)] +#![feature(while_let)] extern crate test;