8000 update to Unicode 9 ; clean up no_std and related · unicode-rs/unicode-xid@02cc96c · GitHub
[go: up one dir, main page]

Skip to content

Commit 02cc96c

Browse files
committed
update to Unicode 9 ; clean up no_std and related
1 parent bc434fd commit 02cc96c

File tree

7 files changed

+342
-338
lines changed

7 files changed

+342
-338
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ language: rust
22
rust: 'nightly'
33
sudo: false
44
script:
5-
- cargo build --verbose --features no_std
6-
- cargo test --verbose --features no_std
5+
- cargo build --verbose --features bench
6+
- cargo test --verbose --features bench
7+
- cargo bench --verbose --features bench
78
- cargo clean
8-
- cargo build --verbose --features default
9-
- cargo test --verbose --features default
10-
- cargo bench --verbose --features default
9+
- cargo build --verbose
10+
- cargo test --verbose
1111
- rustdoc --test README.md -L target/debug -L target/debug/deps
1212
- cargo doc
1313
after_success: |

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "unicode-xid"
4-
version = "0.0.3"
4+
version = "0.0.4"
55
authors = ["erick.tryzelaar <erick.tryzelaar@gmail.com>",
66
"kwantam <kwantam@gmail.com>",
77
]
@@ -23,3 +23,4 @@ exclude = [ "target/*", "Cargo.lock" ]
2323
[features]
2424
default = []
2525
no_std = []
26+
bench = []

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ to your `Cargo.toml`:
3030

3131
```toml
3232
[dependencies]
33-
unicode-xid = "0.0.3"
33+
unicode-xid = "0.0.4"
3434
```

scripts/unicode.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,8 @@ def escape_char(c):
125125
def emit_bsearch_range_table(f):
126126
f.write("""
127127
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
128-
#[cfg(feature = "no_std")]
129128
use core::cmp::Ordering::{Equal, Less, Greater};
130129
131-
#[cfg(feature = "no_std")]
132-
use core::slice::SliceExt;
133-
134-
#[cfg(not(feature = "no_std"))]
135-
use std::cmp::Ordering::{Equal, Less, Greater};
136-
137130
r.binary_search_by(|&(lo,hi)| {
138131
if lo <= c && c <= hi { Equal }
139132
else if hi < c { Less }

src/lib.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,21 @@
3434
//!
3535
//! ```toml
3636
//! [dependencies]
37-
//! unicode-xid = "0.0.3"
37+
//! unicode-xid = "0.0.4"
3838
//! ```
3939
4040
#![deny(missing_docs, unsafe_code)]
4141
#![doc(html_logo_url = "https://unicode-rs.github.io/unicode-rs_sm.png",
4242
html_favicon_url = "https://unicode-rs.github.io/unicode-rs_sm.png")]
4343

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

47-
#![cfg_attr(test, feature(test, unicode))]
48-
49-
#[cfg(all(test, feature = "no_std"))]
47+
#[cfg(test)]
5048
#[macro_use]
5149
extern crate std;
5250

53-
#[cfg(test)]
51+
#[cfg(feature = "bench")]
5452
extern crate test;
5553

5654
use tables::derived_property;

src/tables.rs

Lines changed: 321 additions & 314 deletions
Large diffs are not rendered by default.

src/tests.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#[cfg(feature = "bench")]
1112
use std::iter;
13+
#[cfg(feature = "bench")]
1214
use test::Bencher;
15+
#[cfg(feature = "bench")]
16+
use std::prelude::v1::*;
1317

1418
use super::UnicodeXID;
1519

16-
#[cfg(feature = "no_std")]
17-
use std::prelude::v1::*;
18-
20+
#[cfg(feature = "bench")]
1921
#[bench]
2022
fn cargo_is_xid_start(b: &mut Bencher) {
2123
let string = iter::repeat('a').take(4096).collect::<String>();
@@ -26,6 +28,7 @@ fn cargo_is_xid_start(b: &mut Bencher) {
2628
});
2729
}
2830

31+
#[cfg(feature = "bench")]
2932
#[bench]
3033
fn stdlib_is_xid_start(b: &mut Bencher) {
3134
let string = iter::repeat('a').take(4096).collect::<String>();
@@ -36,6 +39,7 @@ fn stdlib_is_xid_start(b: &mut Bencher) {
3639
});
3740
}
3841

42+
#[cfg(feature = "bench")]
3943
#[bench]
4044
fn cargo_xid_continue(b: &mut Bencher) {
4145
let string = iter::repeat('a').take(4096).collect::<String>();
@@ -46,6 +50,7 @@ fn cargo_xid_continue(b: &mut Bencher) {
4650
});
4751
}
4852

53+
#[cfg(feature = "bench")]
4954
#[bench]
5055
fn stdlib_xid_continue(b: &mut Bencher) {
5156
let string = iter::repeat('a').take(4096).collect::<String>();

0 commit comments

Comments
 (0)
0