Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be753ea

Browse files
authored
Merge pull request #112 from Marcondiro/master
Update CI, add note about MSRV, fix Clippy
2 parents 1598cfa + c7a2cc5 commit be753ea

File tree

3 files changed

+115
-61
lines changed

3 files changed

+115
-61
lines changed

.github/workflows/rust.yml

Lines changed: 101 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -14,74 +14,119 @@ env:
1414
RUSTDOCFLAGS: -D warnings --cfg docsrs
1515

1616
jobs:
17-
build:
17+
get-package-info:
1818
runs-on: ubuntu-latest
19+
outputs:
20+
msrv: ${{ steps.msrv.outputs.metadata }}
21+
name: ${{ steps.name.outputs.metadata }}
22+
version: ${{ steps.version.outputs.metadata }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Get MSRV
26+
id: msrv
27+
uses: nicolaiunrein/[email protected]
28+
with:
29+
subcommand: 'package.rust_version'
30+
- name: Get package name
31+
id: name
32+
uses: nicolaiunrein/[email protected]
33+
with:
34+
subcommand: 'package.name'
35+
- name: Get package version
36+
id: version
37+
uses: nicolaiunrein/[email protected]
38+
with:
39+
subcommand: 'package.version'
40+
41+
build_test:
42+
needs: get-package-info
43+
runs-on: ${{ matrix.os }}
1944
strategy:
2045
matrix:
46+
os: [ ubuntu-latest, windows-latest ]
2147
rust:
48+
- ${{ needs.get-package-info.outputs.msrv }}
2249
- stable
2350
- beta
2451
- nightly
2552
steps:
26-
- uses: actions/checkout@v2
27-
- name: Install toolchain
28-
uses: actions-rs/toolchain@v1
29-
with:
53+
- uses: actions/checkout@v4
54+
- name: Install toolchain
55+
uses: dtolnay/rust-toolchain@master
56+
with:
3057
toolchain: ${{ matrix.rust }}
31-
override: true
3258
components: rustfmt, clippy
33-
- name: Build
34-
run: cargo build --verbose
35-
- name: Run tests with all features
36-
run: cargo test --all-features --verbose
37-
- name: Run tests without features
38-
run: cargo test --no-default-features --verbose
39-
- name: Package
40-
run: cargo package
41-
- name: Test package
42-
run: cd $(find target/package/ -maxdepth 1 -mindepth 1 -type d) && cargo test
43-
- name: Test package without features
44-
run: cd $(find target/package/ -maxdepth 1 -mindepth 1 -type d) && cargo test --no-default-features
45-
- name: Build docs
46-
if: matrix.rust == 'nightly'
47-
run: cargo doc --all-features --verbose
48-
- name: Check formatting
49-
if: matrix.rust == 'stable'
50-
run: cargo fmt --all --check
51-
- name: Check clippy
52-
if: matrix.rust == 'stable'
53-
run: cargo clippy --all-features --lib --tests --examples --verbose
54-
- name: Check benchmarks with clippy
55-
if: matrix.rust == 'nightly'
56-
run: cargo clippy --all-features --benches --verbose
57-
- name: Check fuzz tests with clippy
58-
if: matrix.rust == 'stable'
59-
working-directory: fuzz
60-
run: cargo clippy --all-features --all-targets --verbose
61-
- name: Check fuzz tests formatting
62-
if: matrix.rust == 'stable'
63-
working-directory: fuzz
64-
run: cargo fmt --all --check
65-
msrv:
59+
- name: Use tinyvec 1.6.0
60+
if: matrix.rust == ${{ needs.get-package-info.outputs.msrv }}
61+
run: cargo update -p tinyvec --precise 1.6.0
62+
- name: Build
63+
run: cargo build --verbose
64+
- name: Run tests with all features
65+
run: cargo test --all-features --verbose
66+
- name: Run tests without features
67+
run: cargo test --no-default-features --verbose
68+
- name: Package
69+
run: cargo package --offline
70+
- name: Test package
71+
working-directory: target/package/${{ needs.get-package-info.outputs.name }}-${{ needs.get-package-info.outputs.version }}/
72+
run: cargo test --offline
73+
- name: Test package without features
74+
working-directory: target/package/${{ needs.get-package-info.outputs.name }}-${{ needs.get-package-info.outputs.version }}/
75+
run: cargo test --no-default-features --offline
76+
77+
docs:
78+
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/checkout@v4
81+
- name: Install toolchain
82+
uses: dtolnay/rust-toolchain@master
83+
with:
84+
toolchain: nightly
85+
- name: Build docs
86+
run: cargo doc --all-features --verbose
87+
88+
lints:
89+
runs-on: ubuntu-latest
90+
steps:
91+
- uses: actions/checkout@v4
92+
- name: Install toolchain
93+
uses: dtolnay/rust-toolchain@master
94+
with:
95+
toolchain: stable
96+
components: rustfmt, clippy
97+
- name: Check formatting
98+
run: cargo fmt --all --check
99+
- name: Check clippy
100+
run: cargo clippy --all-features --lib --tests --examples --verbose
101+
- name: Check fuzz tests with clippy
102+
working-directory: fuzz
103+
run: cargo clippy --all-features --all-targets --verbose
104+
- name: Check fuzz tests formatting
105+
working-directory: fuzz
106+
run: cargo fmt --all --check
107+
108+
bench-lints:
66109
runs-on: ubuntu-latest
67110
steps:
68-
- uses: actions/checkout@v2
69-
- name: Install msrv toolchain
70-
uses: dtolnay/[email protected]
71-
- name: Use tinyvec 1.6.0
72-
run: cargo update -p tinyvec --precise 1.6.0
73-
- name: Build
74-
run: cargo build --verbose --all-features
111+
- uses: actions/checkout@v4
112+
- name: Install toolchain
113+
uses: dtolnay/rust-toolchain@master
114+
with:
115+
toolchain: nightly
116+
components: rustfmt, clippy
117+
- name: Check benchmarks with clippy
118+
run: cargo clippy --all-features --benches --verbose
119+
75120
regen:
76121
runs-on: ubuntu-latest
77122
steps:
78-
- uses: actions/checkout@v3
79-
- uses: actions/setup-python@v5
80-
with:
81-
python-version: '3.12'
82-
- name: Regen
83-
run: cd scripts && python3 unicode.py
84-
- name: Diff tables
85-
run: diff src/tables.rs scripts/tables.rs
86-
- name: Diff tests
87-
run: diff tests/data/normalization_tests.rs scripts/normalization_tests.rs
123+
- uses: actions/checkout@v3
124+
- uses: actions/setup-python@v5
125+
with:
126+
python-version: '3.12'
127+
- name: Regen
128+
run: cd scripts && python3 unicode.py
129+
- name: Diff tables
130+
run: diff src/tables.rs scripts/tables.rs
131+
- name: Diff tests
132+
run: diff tests/data/normalization_tests.rs scripts/normalization_tests.rs

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,21 @@ to your `Cargo.toml`:
3131

3232
```toml
3333
[dependencies]
34-
unicode-normalization = "0.1.23"
34+
unicode-normalization = "0.1.24"
3535
```
3636

3737
## `no_std` + `alloc` support
3838

3939
This crate is completely `no_std` + `alloc` compatible. This can be enabled by disabling the `std` feature, i.e. specifying `default-features = false` for this crate on your `Cargo.toml`.
40+
41+
## Note about MSRV
42+
43+
Dependencies' MSRVs evolve independently of this crate's MSRV.
44+
Old versions of cargo will always try to get the most recent versions of the dependencies.
45+
Therefore, if you are having troubles compiling on an old Rust version, try to install an older version of the incompatible dependency.
46+
47+
For instance, to compile on Rust 1.36, `tinyvec` must be `<=1.6.0`
48+
49+
```sh
50+
cargo update -p tinyvec --precise 1.6.0
51+
```

src/stream_safe.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ impl<I: Iterator<Item = char>> Iterator for StreamSafe<I> {
4141

4242
#[inline]
4343
fn next(&mut self) -> Option<char> {
44-
let next_ch = match self.buffer.take().or_else(|| self.iter.next()) {
45-
None => return None,
46-
Some(c) => c,
47-
};
44+
let next_ch = self.buffer.take().or_else(|| self.iter.next())?;
4845
let d = classify_nonstarters(next_ch);
4946
if self.nonstarter_count + d.leading_nonstarters > MAX_NONSTARTERS {
5047
// Since we're emitting a CGJ, the suffix of the emitted string in NFKD has no trailing

0 commit comments

Comments
 (0)