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

Commitb077494

Browse files
Check clippy and formatting in CI
And also mass-reformat.`tables.rs` is ignored for now
1 parent771ddda commitb077494

File tree

10 files changed

+43
-37
lines changed

10 files changed

+43
-37
lines changed

‎.github/workflows/rust.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ on:
77
branches:[ master ]
88

99
env:
10+
CARGO_INCREMENTAL:0
1011
CARGO_TERM_COLOR:always
12+
RUST_BACKTRACE:1
13+
RUSTFLAGS:-D warnings
1114
RUSTDOCFLAGS:-D warnings --cfg docsrs
1215

1316
jobs:
@@ -21,17 +24,17 @@ jobs:
2124
-nightly
2225
steps:
2326
-uses:actions/checkout@v2
24-
-name:Installlatest nightly
27+
-name:Installtoolchain
2528
uses:actions-rs/toolchain@v1
2629
with:
2730
toolchain:${{ matrix.rust }}
2831
override:true
2932
-name:Build
3033
run:cargo build --verbose
31-
-name:Run tests
32-
run:cargo test --verbose
34+
-name:Run tests with all features
35+
run:cargo test --all-features --verbose
3336
-name:Run tests without features
34-
run:cargo test --verbose --no-default-features
37+
run:cargo test --no-default-features --verbose
3538
-name:Package
3639
run:cargo package
3740
-name:Test package
@@ -41,6 +44,12 @@ jobs:
4144
-name:Build docs
4245
if:matrix.rust == 'nightly'
4346
run:cargo doc --all-features --verbose
47+
-name:Check formatting
48+
if:matrix.rust == 'stable'
49+
run:cargo fmt --all --check
50+
-name:Check clippy
51+
if:matrix.rust == 'stable'
52+
run:cargo clippy --all-features --all --verbose
4453
msrv:
4554
runs-on:ubuntu-latest
4655
steps:

‎Cargo.toml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@
22

33
name ="unicode-normalization"
44
version ="0.1.23"
5-
authors = ["kwantam <kwantam@gmail.com>","Manish Goregaokar <manishsmail@gmail.com>"]
5+
authors = [
6+
"kwantam <kwantam@gmail.com>",
7+
"Manish Goregaokar <manishsmail@gmail.com>",
8+
]
69

710
homepage ="https://github.com/unicode-rs/unicode-normalization"
811
repository ="https://github.com/unicode-rs/unicode-normalization"
912
documentation ="https://docs.rs/unicode-normalization/"
1013

1114
license ="MIT/Apache-2.0"
12-
keywords = ["text","unicode","normalization","decomposition","recomposition"]
15+
keywords = [
16+
"text",
17+
"unicode",
18+
"normalization",
19+
"decomposition",
20+
"recomposition",
21+
]
1322
readme ="README.md"
1423
description ="""
1524
This crate provides functions for normalization of
@@ -22,7 +31,7 @@ rust-version = "1.36"
2231

2332
edition ="2018"
2433

25-
exclude = ["target/*","Cargo.lock","scripts/tmp","*.txt","tests/*"]
34+
exclude = ["target/*","Cargo.lock","scripts/tmp","*.txt","tests/*"]
2635

2736
[dependencies.tinyvec]
2837
version ="1"

‎scripts/unicode.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ def minimal_perfect_hash(d):
579579
data=UnicodeData()
580580
withopen("tables.rs","w",newline="\n")asout:
581581
out.write(PREAMBLE)
582+
out.write("#![cfg_attr(rustfmt, rustfmt::skip)]\n")
582583
out.write("use crate::quick_check::IsNormalized;\n")
583584
out.write("use crate::quick_check::IsNormalized::*;\n")
584585
out.write("\n")

‎src/__test_api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// If you're caught using this outside this crates tests/, you get to clean up the mess.
66

77
#[cfg(not(feature ="std"))]
8-
usecrate::no_std_prelude::*;
8+
usealloc::string::String;
99

1010
usecrate::stream_safe::StreamSafe;
1111

‎src/lib.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,7 @@ pub use crate::recompose::Recompositions;
6262
pubusecrate::replace::Replacements;
6363
pubusecrate::stream_safe::StreamSafe;
6464
pubusecrate::tables::UNICODE_VERSION;
65-
use core::{
66-
str::Chars,
67-
option,
68-
};
69-
70-
mod no_std_prelude;
65+
use core::{option, str::Chars};
7166

7267
mod decompose;
7368
mod lookups;
@@ -169,7 +164,6 @@ impl<'a> UnicodeNormalization<Chars<'a>> for &'a str {
169164
}
170165
}
171166

172-
173167
implUnicodeNormalization<option::IntoIter<char>>forchar{
174168
#[inline]
175169
fnnfd(self) ->Decompositions<option::IntoIter<char>>{

‎src/no_std_prelude.rs

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎src/stream_safe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ mod tests {
110110
usecrate::normalize::decompose_compatible;
111111

112112
#[cfg(not(feature ="std"))]
113-
usecrate::no_std_prelude::*;
113+
usealloc::{string::String, vec::Vec};
114114

115115
use core::char;
116116

‎src/tables.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// NOTE: The following code was generated by "scripts/unicode.py", do not edit directly
1212

1313
#![allow(missing_docs)]
14+
#![cfg_attr(rustfmt, rustfmt::skip)]
1415
use crate::quick_check::IsNormalized;
1516
use crate::quick_check::IsNormalized::*;
1617

‎src/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use super::UnicodeNormalization;
1313
use core::char;
1414

1515
#[cfg(not(feature ="std"))]
16-
usecrate::no_std_prelude::*;
16+
usealloc::string::{String,ToString};
1717

1818
#[test]
1919
fntest_nfd(){

‎tests/test_streamsafe_regression.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
use unicode_normalization::{
2-
is_nfc, is_nfc_stream_safe,UnicodeNormalization,
3-
};
4-
5-
#[test]
6-
fntest_streamsafe_regression(){
7-
let input ="\u{342}".repeat(55) +&"\u{344}".repeat(3);
8-
let nfc_ss = input.chars().nfc().stream_safe().collect::<String>();
9-
10-
// The result should be NFC:
11-
assert!(is_nfc(&nfc_ss));
12-
// and should be stream-safe:
13-
assert!(is_nfc_stream_safe(&nfc_ss))
14-
}
1+
use unicode_normalization::{is_nfc, is_nfc_stream_safe,UnicodeNormalization};
2+
3+
#[test]
4+
fntest_streamsafe_regression(){
5+
let input ="\u{342}".repeat(55) +&"\u{344}".repeat(3);
6+
let nfc_ss = input.chars().nfc().stream_safe().collect::<String>();
7+
8+
// The result should be NFC:
9+
assert!(is_nfc(&nfc_ss));
10+
// and should be stream-safe:
11+
assert!(is_nfc_stream_safe(&nfc_ss))
12+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp