Skip to content

Commit 2cc4fcf

Browse files
committed
remove Debug for include array
1 parent 92966d5 commit 2cc4fcf

File tree

4 files changed

+6
-44
lines changed

4 files changed

+6
-44
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lazy-static-include"
3-
version = "1.1.1"
3+
version = "1.1.2"
44
authors = ["Magic Len <len@magiclen.org>"]
55
repository = "https://github.com/magiclen/lazy-static-include"
66
homepage = "https://magiclen.org/lazy-static-include"

data/bool_array-large.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/lib.rs

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -548,18 +548,6 @@ macro_rules! lazy_static_include_bytes {
548548

549549
// TODO -----include_array START-----
550550

551-
#[doc(hidden)]
552-
#[macro_export]
553-
macro_rules! lazy_static_include_array_impl {
554-
( $name:ident ) => {
555-
impl ::std::fmt::Debug for $name {
556-
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
557-
::std::fmt::Debug::fmt(&(*$name)[..], f)
558-
}
559-
}
560-
}
561-
}
562-
563551
#[cfg(not(debug_assertions))]
564552
#[doc(hidden)]
565553
#[macro_export]
@@ -697,7 +685,7 @@ macro_rules! lazy_static_include_array_inner_b {
697685
}
698686

699687
if p != $s {
700-
panic!("incorrect array, file: {}", path);
688+
panic!("incorrect length, {} != {}, file: {}", p, $s, path);
701689
}
702690

703691
result
@@ -797,7 +785,7 @@ macro_rules! lazy_static_include_array_inner_c {
797785
}
798786

799787
if p != $s {
800-
panic!("incorrect array, file: {}", path);
788+
panic!("incorrect length, {} != {}, file: {}", p, $s, path);
801789
}
802790

803791
result
@@ -891,7 +879,7 @@ macro_rules! lazy_static_include_array_inner_s {
891879
}
892880

893881
if result.len() != $s {
894-
panic!("incorrect array, file: {}", path);
882+
panic!("incorrect length, {} != {}, file: {}", result.len(), $s, path);
895883
}
896884

897885
let mut result_str = [""; $s];
@@ -1019,7 +1007,7 @@ macro_rules! lazy_static_include_array_inner_u {
10191007
}
10201008

10211009
if p != $s {
1022-
panic!("incorrect array, file: {}", path);
1010+
panic!("incorrect length, {} != {}, file: {}", p, $s, path);
10231011
}
10241012

10251013
result
@@ -1173,7 +1161,7 @@ macro_rules! lazy_static_include_array_inner_if {
11731161
}
11741162

11751163
if p != $s {
1176-
panic!("incorrect array, file: {}", path);
1164+
panic!("incorrect length, {} != {}, file: {}", p, $s, path);
11771165
}
11781166

11791167
result
@@ -1294,57 +1282,41 @@ macro_rules! lazy_static_include_array {
12941282
lazy_static! {
12951283
static ref $name: [&'static str; $s] = lazy_static_include_array_inner!($name: [&'static str; $s], $path);
12961284
}
1297-
1298-
lazy_static_include_array_impl!($name);
12991285
};
13001286
( $name:ident: [&'static str; $s:expr], $path:expr, $($paths:expr), + ) => {
13011287
lazy_static! {
13021288
static ref $name: Vec<[&'static str; $s]> = lazy_static_include_array_inner!($name: [&'static str; $s], $path $(, $paths)+);
13031289
}
1304-
1305-
lazy_static_include_array_impl!($name);
13061290
};
13071291
( pub $name:ident: [&'static str; $s:expr], $path:expr ) => {
13081292
lazy_static! {
13091293
pub static ref $name: [&'static str; $s] = lazy_static_include_array_inner!($name: [&'static str; $s], $path);
13101294
}
1311-
1312-
lazy_static_include_array_impl!($name);
13131295
};
13141296
( pub $name:ident: [&'static str; $s:expr], $path:expr, $($paths:expr), + ) => {
13151297
lazy_static! {
13161298
pub static ref $name: Vec<[&'static str; $s]> = lazy_static_include_array_inner!($name: [&'static str; $s], $path $(, $paths)+);
13171299
}
1318-
1319-
lazy_static_include_array_impl!($name);
13201300
};
13211301
( $name:ident: [$t:ident; $s:expr], $path:expr ) => {
13221302
lazy_static! {
13231303
static ref $name: [$t; $s] = lazy_static_include_array_inner!($name: [$t; $s], $path);
13241304
}
1325-
1326-
lazy_static_include_array_impl!($name);
13271305
};
13281306
( $name:ident: [$t:ident; $s:expr], $path:expr, $($paths:expr), + ) => {
13291307
lazy_static! {
13301308
static ref $name: Vec<[$t; $s]> = lazy_static_include_array_inner!($name: [$t; $s], $path $(, $paths)+);
13311309
}
1332-
1333-
lazy_static_include_array_impl!($name);
13341310
};
13351311
( pub $name:ident: [$t:ident; $s:expr], $path:expr ) => {
13361312
lazy_static! {
13371313
pub static ref $name: [$t; $s] = lazy_static_include_array_inner!($name: [$t; $s], $path);
13381314
}
1339-
1340-
lazy_static_include_array_impl!($name);
13411315
};
13421316
( pub $name:ident: [$t:ident; $s:expr], $path:expr, $($paths:expr), + ) => {
13431317
lazy_static! {
13441318
pub static ref $name: Vec<[$t; $s]> = lazy_static_include_array_inner!($name: [$t; $s], $path $(, $paths)+);
13451319
}
1346-
1347-
lazy_static_include_array_impl!($name);
13481320
};
13491321
}
13501322

tests/macro.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,4 @@ fn test_include_array_bool() {
237237
assert_eq!(false, TEST[0]);
238238
assert_eq!(true, TEST[1]);
239239
assert_eq!(false, TEST[2]);
240-
}
241-
242-
#[test]
243-
fn test_include_array_bool_large() {
244-
lazy_static_include_array!(TEST: [bool; 40], "data/bool_array-large.txt");
245240
}

0 commit comments

Comments
 (0)