From 59f28f0dd3ff57c827b33fd9a2b088c22e158338 Mon Sep 17 00:00:00 2001 From: kennytm Date: Tue, 7 Oct 2014 00:27:10 +0800 Subject: [PATCH] static -> const; change remaining of x.as_slice() to x[]. --- src/bits.rs | 2 +- src/canvas.rs | 60 ++++++++++++++++++++++++------------------------- src/ec.rs | 6 ++--- src/lib.rs | 4 ++-- src/optimize.rs | 2 +- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/bits.rs b/src/bits.rs index 238f440..fdc6c17 100644 --- a/src/bits.rs +++ b/src/bits.rs @@ -606,7 +606,7 @@ impl Bits { //{{{ Finish // This table is copied from ISO/IEC 18004:2006 ยง6.4.10, Table 7. -static DATA_LENGTHS: [[uint, ..4], ..44] = [ +const DATA_LENGTHS: [[uint, ..4], ..44] = [ // Normal versions [152, 128, 104, 72], [272, 224, 176, 128], diff --git a/src/canvas.rs b/src/canvas.rs index 7c4265e..b2ea11a 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -190,7 +190,7 @@ mod basic_canvas_tests { } } - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ ?????????????????????\n\ ?????????????????????\n\ ?????????????????????\n\ @@ -263,7 +263,7 @@ mod finder_pattern_tests { fn test_qr() { let mut c = Canvas::new(Version(1), L); c.draw_finder_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ #######.?????.#######\n\ #.....#.?????.#.....#\n\ #.###.#.?????.#.###.#\n\ @@ -291,7 +291,7 @@ mod finder_pattern_tests { fn test_micro_qr() { let mut c = Canvas::new(MicroVersion(1), L); c.draw_finder_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ #######.???\n\ #.....#.???\n\ #.###.#.???\n\ @@ -356,7 +356,7 @@ mod alignment_pattern_tests { let mut c = Canvas::new(Version(1), L); c.draw_finder_patterns(); c.draw_alignment_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ #######.?????.#######\n\ #.....#.?????.#.....#\n\ #.###.#.?????.#.###.#\n\ @@ -385,7 +385,7 @@ mod alignment_pattern_tests { let mut c = Canvas::new(Version(3), L); c.draw_finder_patterns(); c.draw_alignment_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ #######.?????????????.#######\n\ #.....#.?????????????.#.....#\n\ #.###.#.?????????????.#.###.#\n\ @@ -422,7 +422,7 @@ mod alignment_pattern_tests { let mut c = Canvas::new(Version(7), L); c.draw_finder_patterns(); c.draw_alignment_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ #######.?????????????????????????????.#######\n\ #.....#.?????????????????????????????.#.....#\n\ #.###.#.?????????????????????????????.#.###.#\n\ @@ -475,7 +475,7 @@ mod alignment_pattern_tests { /// `ALIGNMENT_PATTERN_POSITIONS` describes the x- and y-coordinates of the /// center of the alignment patterns. Since the QR code is symmetric, only one /// coordinate is needed. -static ALIGNMENT_PATTERN_POSITIONS: [&'static [i16], ..34] = [ +const ALIGNMENT_PATTERN_POSITIONS: [&'static [i16], ..34] = [ &[6, 22, 38], &[6, 24, 42], &[6, 26, 46], @@ -567,7 +567,7 @@ mod timing_pattern_tests { fn test_draw_timing_patterns_qr() { let mut c = Canvas::new(Version(1), L); c.draw_timing_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ ?????????????????????\n\ ?????????????????????\n\ ?????????????????????\n\ @@ -595,7 +595,7 @@ mod timing_pattern_tests { fn test_draw_timing_patterns_micro_qr() { let mut c = Canvas::new(MicroVersion(1), L); c.draw_timing_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ ????????#.#\n\ ???????????\n\ ???????????\n\ @@ -673,7 +673,7 @@ mod draw_version_info_tests { fn test_draw_number() { let mut c = Canvas::new(MicroVersion(1), L); c.draw_number(0b10101101u8, Dark, Light, [(0,0), (0,-1), (-2,-2), (-2,0)]); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ #????????.?\n\ ???????????\n\ ???????????\n\ @@ -691,7 +691,7 @@ mod draw_version_info_tests { fn test_draw_version_info_1() { let mut c = Canvas::new(Version(1), L); c.draw_version_info_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ ?????????????????????\n\ ?????????????????????\n\ ?????????????????????\n\ @@ -720,7 +720,7 @@ mod draw_version_info_tests { let mut c = Canvas::new(Version(7), L); c.draw_version_info_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ ??????????????????????????????????..#????????\n\ ??????????????????????????????????.#.????????\n\ ??????????????????????????????????.#.????????\n\ @@ -772,7 +772,7 @@ mod draw_version_info_tests { fn test_draw_reserved_format_info_patterns_qr() { let mut c = Canvas::new(Version(1), L); c.draw_reserved_format_info_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ ????????.????????????\n\ ????????.????????????\n\ ????????.????????????\n\ @@ -800,7 +800,7 @@ mod draw_version_info_tests { fn test_draw_reserved_format_info_patterns_micro_qr() { let mut c = Canvas::new(MicroVersion(1), L); c.draw_reserved_format_info_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ ???????????\n\ ????????.??\n\ ????????.??\n\ @@ -815,7 +815,7 @@ mod draw_version_info_tests { } } -static VERSION_INFO_COORDS_BL: [(i16, i16), ..18] = [ +const VERSION_INFO_COORDS_BL: [(i16, i16), ..18] = [ (5, -9), (5, -10), (5, -11), (4, -9), (4, -10), (4, -11), (3, -9), (3, -10), (3, -11), @@ -824,7 +824,7 @@ static VERSION_INFO_COORDS_BL: [(i16, i16), ..18] = [ (0, -9), (0, -10), (0, -11), ]; -static VERSION_INFO_COORDS_TR: [(i16, i16), ..18] = [ +const VERSION_INFO_COORDS_TR: [(i16, i16), ..18] = [ (-9, 5), (-10, 5), (-11, 5), (-9, 4), (-10, 4), (-11, 4), (-9, 3), (-10, 3), (-11, 3), @@ -833,23 +833,23 @@ static VERSION_INFO_COORDS_TR: [(i16, i16), ..18] = [ (-9, 0), (-10, 0), (-11, 0), ]; -static FORMAT_INFO_COORDS_QR_MAIN: [(i16, i16), ..15] = [ +const FORMAT_INFO_COORDS_QR_MAIN: [(i16, i16), ..15] = [ (0, 8), (1, 8), (2, 8), (3, 8), (4, 8), (5, 8), (7, 8), (8, 8), (8, 7), (8, 5), (8, 4), (8, 3), (8, 2), (8, 1), (8, 0), ]; -static FORMAT_INFO_COORDS_QR_SIDE: [(i16, i16), ..15] = [ +const FORMAT_INFO_COORDS_QR_SIDE: [(i16, i16), ..15] = [ (8, -1), (8, -2), (8, -3), (8, -4), (8, -5), (8, -6), (8, -7), (-8, 8), (-7, 8), (-6, 8), (-5, 8), (-4, 8), (-3, 8), (-2, 8), (-1, 8), ]; -static FORMAT_INFO_COORDS_MICRO_QR: [(i16, i16), ..15] = [ +const FORMAT_INFO_COORDS_MICRO_QR: [(i16, i16), ..15] = [ (1, 8), (2, 8), (3, 8), (4, 8), (5, 8), (6, 8), (7, 8), (8, 8), (8, 7), (8, 6), (8, 5), (8, 4), (8, 3), (8, 2), (8, 1), ]; -static VERSION_INFOS: [u32, ..34] = [ +const VERSION_INFOS: [u32, ..34] = [ 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d, 0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9, 0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75, @@ -886,7 +886,7 @@ mod all_functional_patterns_tests { fn test_all_functional_patterns_qr() { let mut c = Canvas::new(Version(2), L); c.draw_all_functional_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ #######..????????.#######\n\ #.....#..????????.#.....#\n\ #.###.#..????????.#.###.#\n\ @@ -918,7 +918,7 @@ mod all_functional_patterns_tests { fn test_all_functional_patterns_micro_qr() { let mut c = Canvas::new(MicroVersion(1), L); c.draw_all_functional_patterns(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ #######.#.#\n\ #.....#..??\n\ #.###.#..??\n\ @@ -1208,7 +1208,7 @@ mod draw_codewords_test { let mut c = Canvas::new(MicroVersion(1), L); c.draw_all_functional_patterns(); c.draw_data(b"\x6e\x5d\xe2", b"\x2b\x63"); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ #######.#.#\n\ #.....#..-*\n\ #.###.#..**\n\ @@ -1227,7 +1227,7 @@ mod draw_codewords_test { let mut c = Canvas::new(Version(2), L); c.draw_all_functional_patterns(); c.draw_data(b"\x92I$\x92I$\x92I$\x92I$\x92I$\x92I$\x92I$\x92I$\x92I$\x92I$\x92I$\x92I$\x92I$\x92I$\x92I$", b""); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ #######..--*---*-.#######\n\ #.....#..-*-*-*-*.#.....#\n\ #.###.#..*---*---.#.###.#\n\ @@ -1376,7 +1376,7 @@ mod mask_tests { c.draw_all_functional_patterns(); c.apply_mask(Checkerboard); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ #######...#.#.#######\n\ #.....#..#.#..#.....#\n\ #.###.#.#.#.#.#.###.#\n\ @@ -1404,7 +1404,7 @@ mod mask_tests { fn test_draw_format_info_patterns_qr() { let mut c = Canvas::new(Version(1), L); c.draw_format_info_patterns(LargeCheckerboard); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ ????????#????????????\n\ ????????#????????????\n\ ????????#????????????\n\ @@ -1432,7 +1432,7 @@ mod mask_tests { fn test_draw_format_info_patterns_micro_qr() { let mut c = Canvas::new(MicroVersion(2), L); c.draw_format_info_patterns(LargeCheckerboard); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ ?????????????\n\ ????????#????\n\ ????????.????\n\ @@ -1449,14 +1449,14 @@ mod mask_tests { } } -static FORMAT_INFOS_QR: [u16, ..32] = [ +const FORMAT_INFOS_QR: [u16, ..32] = [ 0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, 0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, 0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b, 0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed, ]; -static FORMAT_INFOS_MICRO_QR: [u16, ..32] = [ +const FORMAT_INFOS_MICRO_QR: [u16, ..32] = [ 0x4445, 0x4172, 0x4e2b, 0x4b1c, 0x55ae, 0x5099, 0x5fc0, 0x5af7, 0x6793, 0x62a4, 0x6dfd, 0x68ca, 0x7678, 0x734f, 0x7c16, 0x7921, 0x06de, 0x03e9, 0x0cb0, 0x0987, 0x1735, 0x1202, 0x1d5b, 0x186c, @@ -1628,7 +1628,7 @@ mod penalty_tests { #[test] fn check_penalty_canvas() { let c = create_test_canvas(); - assert_eq!(c.to_debug_str().as_slice(), "\n\ + assert_eq!(c.to_debug_str()[], "\n\ #######.##....#######\n\ #.....#.#..#..#.....#\n\ #.###.#.#..##.#.###.#\n\ diff --git a/src/ec.rs b/src/ec.rs index e47bbfd..431526a 100644 --- a/src/ec.rs +++ b/src/ec.rs @@ -187,10 +187,10 @@ mod construct_codewords_test { //{{{ Precomputed tables for GF(256). /// `EXP_TABLE` encodes the value of 2n in the Galois Field GF(256). -static EXP_TABLE: &'static [u8] = b"\x01\x02\x04\x08\x10\x20\x40\x80\x1d\x3a\x74\xe8\xcd\x87\x13\x26\x4c\x98\x2d\x5a\xb4\x75\xea\xc9\x8f\x03\x06\x0c\x18\x30\x60\xc0\x9d\x27\x4e\x9c\x25\x4a\x94\x35\x6a\xd4\xb5\x77\xee\xc1\x9f\x23\x46\x8c\x05\x0a\x14\x28\x50\xa0\x5d\xba\x69\xd2\xb9\x6f\xde\xa1\x5f\xbe\x61\xc2\x99\x2f\x5e\xbc\x65\xca\x89\x0f\x1e\x3c\x78\xf0\xfd\xe7\xd3\xbb\x6b\xd6\xb1\x7f\xfe\xe1\xdf\xa3\x5b\xb6\x71\xe2\xd9\xaf\x43\x86\x11\x22\x44\x88\x0d\x1a\x34\x68\xd0\xbd\x67\xce\x81\x1f\x3e\x7c\xf8\xed\xc7\x93\x3b\x76\xec\xc5\x97\x33\x66\xcc\x85\x17\x2e\x5c\xb8\x6d\xda\xa9\x4f\x9e\x21\x42\x84\x15\x2a\x54\xa8\x4d\x9a\x29\x52\xa4\x55\xaa\x49\x92\x39\x72\xe4\xd5\xb7\x73\xe6\xd1\xbf\x63\xc6\x91\x3f\x7e\xfc\xe5\xd7\xb3\x7b\xf6\xf1\xff\xe3\xdb\xab\x4b\x96\x31\x62\xc4\x95\x37\x6e\xdc\xa5\x57\xae\x41\x82\x19\x32\x64\xc8\x8d\x07\x0e\x1c\x38\x70\xe0\xdd\xa7\x53\xa6\x51\xa2\x59\xb2\x79\xf2\xf9\xef\xc3\x9b\x2b\x56\xac\x45\x8a\x09\x12\x24\x48\x90\x3d\x7a\xf4\xf5\xf7\xf3\xfb\xeb\xcb\x8b\x0b\x16\x2c\x58\xb0\x7d\xfa\xe9\xcf\x83\x1b\x36\x6c\xd8\xad\x47\x8e\x01"; +const EXP_TABLE: &'static [u8] = b"\x01\x02\x04\x08\x10\x20\x40\x80\x1d\x3a\x74\xe8\xcd\x87\x13\x26\x4c\x98\x2d\x5a\xb4\x75\xea\xc9\x8f\x03\x06\x0c\x18\x30\x60\xc0\x9d\x27\x4e\x9c\x25\x4a\x94\x35\x6a\xd4\xb5\x77\xee\xc1\x9f\x23\x46\x8c\x05\x0a\x14\x28\x50\xa0\x5d\xba\x69\xd2\xb9\x6f\xde\xa1\x5f\xbe\x61\xc2\x99\x2f\x5e\xbc\x65\xca\x89\x0f\x1e\x3c\x78\xf0\xfd\xe7\xd3\xbb\x6b\xd6\xb1\x7f\xfe\xe1\xdf\xa3\x5b\xb6\x71\xe2\xd9\xaf\x43\x86\x11\x22\x44\x88\x0d\x1a\x34\x68\xd0\xbd\x67\xce\x81\x1f\x3e\x7c\xf8\xed\xc7\x93\x3b\x76\xec\xc5\x97\x33\x66\xcc\x85\x17\x2e\x5c\xb8\x6d\xda\xa9\x4f\x9e\x21\x42\x84\x15\x2a\x54\xa8\x4d\x9a\x29\x52\xa4\x55\xaa\x49\x92\x39\x72\xe4\xd5\xb7\x73\xe6\xd1\xbf\x63\xc6\x91\x3f\x7e\xfc\xe5\xd7\xb3\x7b\xf6\xf1\xff\xe3\xdb\xab\x4b\x96\x31\x62\xc4\x95\x37\x6e\xdc\xa5\x57\xae\x41\x82\x19\x32\x64\xc8\x8d\x07\x0e\x1c\x38\x70\xe0\xdd\xa7\x53\xa6\x51\xa2\x59\xb2\x79\xf2\xf9\xef\xc3\x9b\x2b\x56\xac\x45\x8a\x09\x12\x24\x48\x90\x3d\x7a\xf4\xf5\xf7\xf3\xfb\xeb\xcb\x8b\x0b\x16\x2c\x58\xb0\x7d\xfa\xe9\xcf\x83\x1b\x36\x6c\xd8\xad\x47\x8e\x01"; /// `LOG_TABLE` is the inverse function of `EXP_TABLE`. -static LOG_TABLE: &'static [u8] = b"\xff\x00\x01\x19\x02\x32\x1a\xc6\x03\xdf\x33\xee\x1b\x68\xc7\x4b\x04\x64\xe0\x0e\x34\x8d\xef\x81\x1c\xc1\x69\xf8\xc8\x08\x4c\x71\x05\x8a\x65\x2f\xe1\x24\x0f\x21\x35\x93\x8e\xda\xf0\x12\x82\x45\x1d\xb5\xc2\x7d\x6a\x27\xf9\xb9\xc9\x9a\x09\x78\x4d\xe4\x72\xa6\x06\xbf\x8b\x62\x66\xdd\x30\xfd\xe2\x98\x25\xb3\x10\x91\x22\x88\x36\xd0\x94\xce\x8f\x96\xdb\xbd\xf1\xd2\x13\x5c\x83\x38\x46\x40\x1e\x42\xb6\xa3\xc3\x48\x7e\x6e\x6b\x3a\x28\x54\xfa\x85\xba\x3d\xca\x5e\x9b\x9f\x0a\x15\x79\x2b\x4e\xd4\xe5\xac\x73\xf3\xa7\x57\x07\x70\xc0\xf7\x8c\x80\x63\x0d\x67\x4a\xde\xed\x31\xc5\xfe\x18\xe3\xa5\x99\x77\x26\xb8\xb4\x7c\x11\x44\x92\xd9\x23\x20\x89\x2e\x37\x3f\xd1\x5b\x95\xbc\xcf\xcd\x90\x87\x97\xb2\xdc\xfc\xbe\x61\xf2\x56\xd3\xab\x14\x2a\x5d\x9e\x84\x3c\x39\x53\x47\x6d\x41\xa2\x1f\x2d\x43\xd8\xb7\x7b\xa4\x76\xc4\x17\x49\xec\x7f\x0c\x6f\xf6\x6c\xa1\x3b\x52\x29\x9d\x55\xaa\xfb\x60\x86\xb1\xbb\xcc\x3e\x5a\xcb\x59\x5f\xb0\x9c\xa9\xa0\x51\x0b\xf5\x16\xeb\x7a\x75\x2c\xd7\x4f\xae\xd5\xe9\xe6\xe7\xad\xe8\x74\xd6\xf4\xea\xa8\x50\x58\xaf"; +const LOG_TABLE: &'static [u8] = b"\xff\x00\x01\x19\x02\x32\x1a\xc6\x03\xdf\x33\xee\x1b\x68\xc7\x4b\x04\x64\xe0\x0e\x34\x8d\xef\x81\x1c\xc1\x69\xf8\xc8\x08\x4c\x71\x05\x8a\x65\x2f\xe1\x24\x0f\x21\x35\x93\x8e\xda\xf0\x12\x82\x45\x1d\xb5\xc2\x7d\x6a\x27\xf9\xb9\xc9\x9a\x09\x78\x4d\xe4\x72\xa6\x06\xbf\x8b\x62\x66\xdd\x30\xfd\xe2\x98\x25\xb3\x10\x91\x22\x88\x36\xd0\x94\xce\x8f\x96\xdb\xbd\xf1\xd2\x13\x5c\x83\x38\x46\x40\x1e\x42\xb6\xa3\xc3\x48\x7e\x6e\x6b\x3a\x28\x54\xfa\x85\xba\x3d\xca\x5e\x9b\x9f\x0a\x15\x79\x2b\x4e\xd4\xe5\xac\x73\xf3\xa7\x57\x07\x70\xc0\xf7\x8c\x80\x63\x0d\x67\x4a\xde\xed\x31\xc5\xfe\x18\xe3\xa5\x99\x77\x26\xb8\xb4\x7c\x11\x44\x92\xd9\x23\x20\x89\x2e\x37\x3f\xd1\x5b\x95\xbc\xcf\xcd\x90\x87\x97\xb2\xdc\xfc\xbe\x61\xf2\x56\xd3\xab\x14\x2a\x5d\x9e\x84\x3c\x39\x53\x47\x6d\x41\xa2\x1f\x2d\x43\xd8\xb7\x7b\xa4\x76\xc4\x17\x49\xec\x7f\x0c\x6f\xf6\x6c\xa1\x3b\x52\x29\x9d\x55\xaa\xfb\x60\x86\xb1\xbb\xcc\x3e\x5a\xcb\x59\x5f\xb0\x9c\xa9\xa0\x51\x0b\xf5\x16\xeb\x7a\x75\x2c\xd7\x4f\xae\xd5\xe9\xe6\xe7\xad\xe8\x74\xd6\xf4\xea\xa8\x50\x58\xaf"; /// The generator polynomial list. /// @@ -201,7 +201,7 @@ static LOG_TABLE: &'static [u8] = b"\xff\x00\x01\x19\x02\x32\x1a\xc6\x03\xdf\x33 /// is the Reed-Solomon error correction code. /// /// A partial list can be found from ISO/IEC 18004:2006 Annex A. -static GENERATOR_POLYNOMIALS: [&'static [u8], ..70] = [ +const GENERATOR_POLYNOMIALS: [&'static [u8], ..70] = [ b"", b"\x00", b"\x19\x01", diff --git a/src/lib.rs b/src/lib.rs index 01c88df..8cb8504 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -189,7 +189,7 @@ mod tests { fn test_annex_i_qr() { // This uses the ISO Annex I as test vector. let code = QrCode::with_version(b"01234567", Version(1), M).unwrap(); - assert_eq!(code.to_debug_str('#', '.').as_slice(), "\n\ + assert_eq!(code.to_debug_str('#', '.')[], "\n\ #######..#.##.#######\n\ #.....#..####.#.....#\n\ #.###.#.#.....#.###.#\n\ @@ -216,7 +216,7 @@ mod tests { #[test] fn test_annex_i_micro_qr() { let code = QrCode::with_version(b"01234567", MicroVersion(2), L).unwrap(); - assert_eq!(code.to_debug_str('#', '.').as_slice(), "\n\ + assert_eq!(code.to_debug_str('#', '.')[], "\n\ #######.#.#.#\n\ #.....#.###.#\n\ #.###.#..##.#\n\ diff --git a/src/optimize.rs b/src/optimize.rs index 33f5b10..cc34ca4 100644 --- a/src/optimize.rs +++ b/src/optimize.rs @@ -561,7 +561,7 @@ enum ParserAction { AKanjiAndSingleByte, } -static STATE_TRANSITION: [(SegmentParseState, ParserAction), ..70] = [ +const STATE_TRANSITION: [(SegmentParseState, ParserAction), ..70] = [ // STATE_TRANSITION[current_state + next_character] == (next_state, what_to_do) // Init state: