Rustup (fail! -> panic!).
This commit is contained in:
parent
c008e97c8f
commit
b3b742b3ab
|
@ -142,7 +142,7 @@ impl Canvas {
|
||||||
/// negative coordinates will wrap around.
|
/// negative coordinates will wrap around.
|
||||||
pub fn get_mut(&mut self, x: i16, y: i16) -> &mut Module {
|
pub fn get_mut(&mut self, x: i16, y: i16) -> &mut Module {
|
||||||
let index = self.coords_to_index(x, y);
|
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,
|
/// Sets the color of a module at the given coordinates. For convenience,
|
||||||
|
@ -185,7 +185,7 @@ mod basic_canvas_tests {
|
||||||
2 => Dark,
|
2 => Dark,
|
||||||
3 => LightUnmasked,
|
3 => LightUnmasked,
|
||||||
4 => DarkUnmasked,
|
4 => DarkUnmasked,
|
||||||
_ => fail!(),
|
_ => panic!(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1348,7 +1348,7 @@ impl Canvas {
|
||||||
LargeCheckerboard => 0b01,
|
LargeCheckerboard => 0b01,
|
||||||
Diamonds => 0b10,
|
Diamonds => 0b10,
|
||||||
Meadow => 0b11,
|
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) {
|
let symbol_number = match (a, self.ec_level) {
|
||||||
(1, L) => 0b000,
|
(1, L) => 0b000,
|
||||||
|
@ -1359,7 +1359,7 @@ impl Canvas {
|
||||||
(4, L) => 0b101,
|
(4, L) => 0b101,
|
||||||
(4, M) => 0b110,
|
(4, M) => 0b110,
|
||||||
(4, Q) => 0b111,
|
(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;
|
let simple_format_number = symbol_number << 2 | micro_pattern_number;
|
||||||
FORMAT_INFOS_MICRO_QR[simple_format_number]
|
FORMAT_INFOS_MICRO_QR[simple_format_number]
|
||||||
|
|
|
@ -8,7 +8,7 @@ use types::{QrResult, QrVersion, ErrorCorrectionLevel};
|
||||||
/// Creates the error correction code in N bytes.
|
/// Creates the error correction code in N bytes.
|
||||||
///
|
///
|
||||||
/// This method only supports computing the error-correction code up to
|
/// 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
|
/// This method treats the data as a polynomial of the form
|
||||||
/// (a[0] x<sup>m+n</sup> + a[1] x<sup>m+n-1</sup> + … + a[m] x<sup>n</sup>) in
|
/// (a[0] x<sup>m+n</sup> + a[1] x<sup>m+n-1</sup> + … + a[m] x<sup>n</sup>) in
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//!
|
//!
|
||||||
//! let code = QrCode::new(b"Some content here.");
|
//! let code = QrCode::new(b"Some content here.");
|
||||||
//! match code {
|
//! match code {
|
||||||
//! Err(err) => fail!("Failed to encode the QR code: {}", err),
|
//! Err(err) => panic!("Failed to encode the QR code: {}", err),
|
||||||
//! Ok(code) => {
|
//! Ok(code) => {
|
||||||
//! for y in range(0, code.width()) {
|
//! for y in range(0, code.width()) {
|
||||||
//! for x in range(0, code.width()) {
|
//! for x in range(0, code.width()) {
|
||||||
|
|
Loading…
Reference in a new issue