Skip to content

Commit 4557dcd

Browse files
committed
update project
1 parent 058ca5a commit 4557dcd

File tree

4 files changed

+14
-23
lines changed

4 files changed

+14
-23
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
toolchain: nightly
2929
override: true
3030
components: clippy
31-
- run: cargo clippy -- -D warnings
31+
- run: cargo clippy --all-targets --all-features -- -D warnings
3232

3333
tests:
3434
strategy:

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "lazy-static-include"
3-
version = "3.1.1"
3+
version = "3.1.2"
44
authors = ["Magic Len <len@magiclen.org>"]
5-
edition = "2018"
5+
edition = "2021"
66
repository = "https://github.com/magiclen/lazy-static-include"
77
homepage = "https://magiclen.org/lazy-static-include"
88
keywords = ["lazy", "macro", "static", "include"]
@@ -22,6 +22,8 @@ bencher = "0.1.5"
2222
serde_json = "1.0"
2323
assert_approx_eq = "1.1"
2424

25+
slash-formatter = "3.1.3"
26+
2527
[[bench]]
2628
name = "bench"
2729
harness = false

benches/bench.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
1-
#[macro_use]
2-
extern crate bencher;
3-
41
#[macro_use]
52
extern crate lazy_static_include;
63

7-
#[macro_use]
8-
extern crate slash_formatter;
9-
10-
extern crate serde_json;
11-
124
use std::fs::File;
135
use std::io::Read;
146
use std::str::from_utf8_unchecked;
157

16-
use bencher::Bencher;
8+
use bencher::{benchmark_group, benchmark_main, Bencher};
9+
use slash_formatter::concat_with_file_separator;
1710

1811
macro_rules! benchmark_text_path {
1912
() => {
2013
concat_with_file_separator!(env!("CARGO_MANIFEST_DIR"), "data", "benchmark.txt")
2114
};
22-
(relative) => {
23-
concat_with_file_separator!("data", "benchmark.txt")
24-
};
2515
}
2616

2717
fn include_str_no_static(bencher: &mut Bencher) {
@@ -46,7 +36,7 @@ fn include_str_native_static(bencher: &mut Bencher) {
4636

4737
fn include_str_lazy_static(bencher: &mut Bencher) {
4838
lazy_static_include_str! {
49-
pub TEXT => benchmark_text_path!(relative)
39+
pub TEXT => "data/benchmark.txt"
5040
}
5141

5242
bencher.iter(|| TEXT.contains("figarofigaro"));
@@ -78,7 +68,7 @@ fn include_bytes_native_static(bencher: &mut Bencher) {
7868

7969
fn include_bytes_lazy_static(bencher: &mut Bencher) {
8070
lazy_static_include_bytes! {
81-
DATA => benchmark_text_path!(relative)
71+
DATA => "data/benchmark.txt"
8272
}
8373

8474
bencher.iter(|| {
@@ -112,7 +102,7 @@ fn include_array_native_static(bencher: &mut Bencher) {
112102

113103
fn include_array_lazy_static(bencher: &mut Bencher) {
114104
lazy_static_include_array! {
115-
ARRAY: [&'static str; 622] => benchmark_text_path!(relative)
105+
ARRAY: [&'static str; 622] => "data/benchmark.txt"
116106
}
117107

118108
bencher.iter(|| ARRAY.binary_search(&"figarofigaro").is_ok());

tests/macros.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#[macro_use]
22
extern crate lazy_static_include;
33

4-
#[macro_use]
5-
extern crate assert_approx_eq;
4+
use assert_approx_eq::assert_approx_eq;
65

76
#[test]
87
fn include_str() {
@@ -229,9 +228,9 @@ fn include_array_bool() {
229228
pub TEST: [bool; 3] => "data/bool_array.txt",
230229
}
231230

232-
assert_eq!(false, TEST[0]);
233-
assert_eq!(true, TEST[1]);
234-
assert_eq!(false, TEST[2]);
231+
assert!(!TEST[0]);
232+
assert!(TEST[1]);
233+
assert!(!TEST[2]);
235234
}
236235

237236
#[test]

0 commit comments

Comments
 (0)