Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2d713ab

Browse files
Check benches and fuzz tests in CI
1 parenta6a221a commit2d713ab

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

‎.github/workflows/rust.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
with:
3030
toolchain:${{ matrix.rust }}
3131
override:true
32+
components:rustfmt, clippy
3233
-name:Build
3334
run:cargo build --verbose
3435
-name:Run tests with all features
@@ -49,7 +50,18 @@ jobs:
4950
run:cargo fmt --all --check
5051
-name:Check clippy
5152
if:matrix.rust == 'stable'
52-
run:cargo clippy --all-features --all --verbose
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
5365
msrv:
5466
runs-on:ubuntu-latest
5567
steps:

‎benches/bench.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use std::fs;
77
use test::Bencher;
88
use unicode_normalization::UnicodeNormalization;
99

10-
constASCII:&'staticstr ="all types of normalized";
11-
constNFC:&'staticstr ="Introducci\u{00f3}n a Unicode.pdf";
12-
constNFD:&'staticstr ="Introduccio\u{0301}n a Unicode.pdf";
10+
constASCII:&str ="all types of normalized";
11+
constNFC:&str ="Introducci\u{00f3}n a Unicode.pdf";
12+
constNFD:&str ="Introduccio\u{0301}n a Unicode.pdf";
1313

1414
#[bench]
1515
fnbench_is_nfc_ascii(b:&mutBencher){

‎fuzz/fuzz_targets/streaming.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
#[macro_use]
1414
externcrate libfuzzer_sys;
1515

16-
use std::str::Chars;
1716
use std::cell::RefCell;
1817
use std::rc::Rc;
18+
use std::str::Chars;
1919
use unicode_normalization::{char::canonical_combining_class,UnicodeNormalization};
2020

2121
constMAX_NONSTARTERS:u32 =30;
@@ -43,8 +43,11 @@ impl<'a> Iterator for Counter<'a> {
4343
fuzz_target!(|input:String|{
4444
let stream_safe = input.chars().stream_safe().collect::<String>();
4545

46-
letmut value =Rc::new(RefCell::new(0));
47-
let counter =Counter{ iter: stream_safe.chars(), value:Rc::clone(&mut value)};
46+
let value =Rc::new(RefCell::new(0));
47+
let counter =Counter{
48+
iter: stream_safe.chars(),
49+
value:Rc::clone(&value),
50+
};
4851
for _ in counter.nfc(){
4952
// Plus 1: The iterator may consume a starter that begins the next sequence.
5053
assert!(*value.borrow() <=MAX_NONSTARTERS +1);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp