Skip to content

Commit 6a681a7

Browse files
authored
Merge pull request #10 from ZackPierce/fix_bench_and_cleanup
Fix CI build by updating feature associated with 'bench' feature
2 parents 488b6c4 + 87a1511 commit 6a681a7

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

scripts/unicode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def escape_char(c):
124124

125125
def emit_bsearch_range_table(f):
126126
f.write("""
127-
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
127+
fn bsearch_range_table(c: char, r: &[(char,char)]) -> bool {
128128
use core::cmp::Ordering::{Equal, Less, Greater};
129129
130130
r.binary_search_by(|&(lo,hi)| {
@@ -135,7 +135,7 @@ def emit_bsearch_range_table(f):
135135
}\n
136136
""")
137137

138-
def emit_table(f, name, t_data, t_type = "&'static [(char, char)]", is_pub=True,
138+
def emit_table(f, name, t_data, t_type = "&[(char, char)]", is_pub=True,
139139
pfun=lambda x: "(%s,%s)" % (escape_char(x[0]), escape_char(x[1])), is_const=True):
140140
pub_string = "const"
141141
if not is_const:

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
html_favicon_url = "https://unicode-rs.github.io/unicode-rs_sm.png")]
4343

4444
#![no_std]
45-
#![cfg_attr(feature = "bench", feature(test, unicode))]
45+
#![cfg_attr(feature = "bench", feature(test, rustc_private))]
4646

4747
#[cfg(test)]
4848
#[macro_use]

src/tables.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
2727
}
2828

2929
pub mod derived_property {
30-
pub const XID_Continue_table: &'static [(char, char)] = &[
30+
pub const XID_Continue_table: &[(char, char)] = &[
3131
('\u{30}', '\u{39}'), ('\u{41}', '\u{5a}'), ('\u{5f}', '\u{5f}'), ('\u{61}', '\u{7a}'),
3232
('\u{aa}', '\u{aa}'), ('\u{b5}', '\u{b5}'), ('\u{b7}', '\u{b7}'), ('\u{ba}', '\u{ba}'),
3333
('\u{c0}', '\u{d6}'), ('\u{d8}', '\u{f6}'), ('\u{f8}', '\u{2c1}'), ('\u{2c6}', '\u{2d1}'),
@@ -241,7 +241,7 @@ pub mod derived_property {
241241
super::bsearch_range_table(c, XID_Continue_table)
242242
}
243243

244-
pub const XID_Start_table: &'static [(char, char)] = &[
244+
pub const XID_Start_table: &[(char, char)] = &[
245245
('\u{41}', '\u{5a}'), ('\u{61}', '\u{7a}'), ('\u{aa}', '\u{aa}'), ('\u{b5}', '\u{b5}'),
246246
('\u{ba}', '\u{ba}'), ('\u{c0}', '\u{d6}'), ('\u{d8}', '\u{f6}'), ('\u{f8}', '\u{2c1}'),
247247
('\u{2c6}', '\u{2d1}'), ('\u{2e0}', '\u{2e4}'), ('\u{2ec}', '\u{2ec}'), ('\u{2ee}',

src/tests.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@ use test::Bencher;
1515
#[cfg(feature = "bench")]
1616
use std::prelude::v1::*;
1717

18-
use super::UnicodeXID;
19-
2018
#[cfg(feature = "bench")]
2119
#[bench]
2220
fn cargo_is_xid_start(b: &mut Bencher) {
2321
let string = iter::repeat('a').take(4096).collect::<String>();
2422

2523
b.bytes = string.len() as u64;
2624
b.iter(|| {
27-
string.chars().all(UnicodeXID::is_xid_start)
25+
string.chars().all(super::UnicodeXID::is_xid_start)
2826
});
2927
}
3028

@@ -46,7 +44,7 @@ fn cargo_xid_continue(b: &mut Bencher) {
4644

4745
b.bytes = string.len() as u64;
4846
b.iter(|| {
49-
string.chars().all(UnicodeXID::is_xid_continue)
47+
string.chars().all(super::UnicodeXID::is_xid_continue)
5048
});
5149
}
5250

@@ -69,7 +67,7 @@ fn test_is_xid_start() {
6967
];
7068

7169
for ch in &chars {
72-
assert!(UnicodeXID::is_xid_start(*ch), "{}", ch);
70+
assert!(super::UnicodeXID::is_xid_start(*ch), "{}", ch);
7371
}
7472
}
7573

@@ -83,7 +81,7 @@ fn test_is_not_xid_start() {
8381
];
8482

8583
for ch in &chars {
86-
assert!(!UnicodeXID::is_xid_start(*ch), "{}", ch);
84+
assert!(!super::UnicodeXID::is_xid_start(*ch), "{}", ch);
8785
}
8886
}
8987

@@ -95,7 +93,7 @@ fn test_is_xid_continue() {
9593
];
9694

9795
for ch in &chars {
98-
assert!(UnicodeXID::is_xid_continue(*ch), "{}", ch);
96+
assert!(super::UnicodeXID::is_xid_continue(*ch), "{}", ch);
9997
}
10098
}
10199

@@ -108,6 +106,6 @@ fn test_is_not_xid_continue() {
108106
];
109107

110108
for &ch in &chars {
111-
assert!(!UnicodeXID::is_xid_continue(ch), "{}", ch);
109+
assert!(!super::UnicodeXID::is_xid_continue(ch), "{}", ch);
112110
}
113111
}

0 commit comments

Comments
 (0)