Skip to content

Commit

Permalink
update to Unicode 9 ; clean up no_std and related
Browse files Browse the repository at this point in the history
  • Loading branch information
kwantam committed Dec 24, 2016
1 parent bc434fd commit 02cc96c
Show file tree
Hide file tree
Showing 7 changed files with 342 additions and 338 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ language: rust
rust: 'nightly'
sudo: false
script:
- cargo build --verbose --features no_std
- cargo test --verbose --features no_std
- cargo build --verbose --features bench
- cargo test --verbose --features bench
- cargo bench --verbose --features bench
- cargo clean
- cargo build --verbose --features default
- cargo test --verbose --features default
- cargo bench --verbose --features default
- cargo build --verbose
- cargo test --verbose
- rustdoc --test README.md -L target/debug -L target/debug/deps
- cargo doc
after_success: |
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "unicode-xid"
version = "0.0.3"
version = "0.0.4"
authors = ["erick.tryzelaar <erick.tryzelaar@gmail.com>",
"kwantam <kwantam@gmail.com>",
]
Expand All @@ -23,3 +23,4 @@ exclude = [ "target/*", "Cargo.lock" ]
[features]
default = []
no_std = []
bench = []
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ to your `Cargo.toml`:

```toml
[dependencies]
unicode-xid = "0.0.3"
unicode-xid = "0.0.4"
```
7 changes: 0 additions & 7 deletions scripts/unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,8 @@ def escape_char(c):
def emit_bsearch_range_table(f):
f.write("""
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
#[cfg(feature = "no_std")]
use core::cmp::Ordering::{Equal, Less, Greater};
#[cfg(feature = "no_std")]
use core::slice::SliceExt;
#[cfg(not(feature = "no_std"))]
use std::cmp::Ordering::{Equal, Less, Greater};
r.binary_search_by(|&(lo,hi)| {
if lo <= c && c <= hi { Equal }
else if hi < c { Less }
Expand Down
12 changes: 5 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,21 @@
//!
//! ```toml
//! [dependencies]
//! unicode-xid = "0.0.3"
//! unicode-xid = "0.0.4"
//! ```

#![deny(missing_docs, unsafe_code)]
#![doc(html_logo_url = "https://unicode-rs.github.io/unicode-rs_sm.png",
html_favicon_url = "https://unicode-rs.github.io/unicode-rs_sm.png")]

#![cfg_attr(feature = "no_std", no_std)]
#![cfg_attr(feature = "no_std", feature(no_std, core_slice_ext))]
#![no_std]
#![cfg_attr(feature = "bench", feature(test, unicode))]

#![cfg_attr(test, feature(test, unicode))]

#[cfg(all(test, feature = "no_std"))]
#[cfg(test)]
#[macro_use]
extern crate std;

#[cfg(test)]
#[cfg(feature = "bench")]
extern crate test;

use tables::derived_property;
Expand Down
635 changes: 321 additions & 314 deletions src/tables.rs

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[cfg(feature = "bench")]
use std::iter;
#[cfg(feature = "bench")]
use test::Bencher;
#[cfg(feature = "bench")]
use std::prelude::v1::*;

use super::UnicodeXID;

#[cfg(feature = "no_std")]
use std::prelude::v1::*;

#[cfg(feature = "bench")]
#[bench]
fn cargo_is_xid_start(b: &mut Bencher) {
let string = iter::repeat('a').take(4096).collect::<String>();
Expand All @@ -26,6 +28,7 @@ fn cargo_is_xid_start(b: &mut Bencher) {
});
}

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

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

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

0 comments on commit 02cc96c

Please sign in to comment.