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

Commit85ae6c0

Browse files
committed
Add CI, apply rustfmt
1 parentdca4718 commit85ae6c0

File tree

6 files changed

+61
-21
lines changed

6 files changed

+61
-21
lines changed

‎.github/workflows/rustfmt.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name:Rustfmt
2+
3+
on:[push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on:ubuntu-latest
9+
10+
steps:
11+
-uses:actions/checkout@v1
12+
-name:Run rustfmt
13+
run:cargo fmt -- --check

‎.github/workflows/tests.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name:Tests
2+
3+
on:[push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on:ubuntu-latest
9+
10+
steps:
11+
-uses:actions/checkout@v1
12+
-uses:actions-rs/toolchain@v1
13+
with:
14+
profile:minimal
15+
toolchain:beta
16+
override:true
17+
components:rustfmt
18+
-name:Build
19+
run:cargo build --verbose
20+
-name:Run tests
21+
run:cargo test

‎src/general_security_profile.rs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ pub trait GeneralSecurityProfile {
1616

1717
implGeneralSecurityProfileforchar{
1818
#[inline]
19-
fnidentifier_allowed(self) ->bool{ identifier::identifier_status_allowed(self)}
19+
fnidentifier_allowed(self) ->bool{
20+
identifier::identifier_status_allowed(self)
21+
}
2022
#[inline]
21-
fnidentifier_type(self) ->Option<IdentifierType>{ identifier::identifier_type(self)}
22-
23+
fnidentifier_type(self) ->Option<IdentifierType>{
24+
identifier::identifier_type(self)
25+
}
2326
}

‎src/lib.rs‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
//! let ch = 'µ'; // U+00B5 MICRO SIGN
2222
//! let allowed = 'µ'.identifier_allowed();
2323
//! println!("{}", ch);
24-
//! println!("The above char is {} in unicode identifiers.",
24+
//! println!("The above char is {} in unicode identifiers.",
2525
//! if allowed { "allowed" } else { "restricted" });
2626
//! }
2727
//! ```
@@ -42,9 +42,10 @@
4242
//! ```
4343
4444
#![deny(missing_docs, unsafe_code)]
45-
#![doc(html_logo_url ="https://unicode-rs.github.io/unicode-rs_sm.png",
46-
html_favicon_url ="https://unicode-rs.github.io/unicode-rs_sm.png")]
47-
45+
#![doc(
46+
html_logo_url ="https://unicode-rs.github.io/unicode-rs_sm.png",
47+
html_favicon_url ="https://unicode-rs.github.io/unicode-rs_sm.png"
48+
)]
4849
#![cfg_attr(feature ="bench", feature(test))]
4950
#![no_std]
5051

@@ -57,12 +58,12 @@ extern crate test;
5758

5859
pubuse tables::UNICODE_VERSION;
5960

60-
pubmod mixed_script;
6161
pubmod general_security_profile;
62+
pubmod mixed_script;
6263
pubmod restriction_level;
6364

64-
pubuse mixed_script::MixedScript;
6565
pubuse general_security_profile::GeneralSecurityProfile;
66+
pubuse mixed_script::MixedScript;
6667

6768
#[rustfmt::skip]
6869
pub(crate)mod tables;

‎src/mixed_script.rs‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ impl From<ScriptExtension> for AugmentedScriptSet {
2323
letmut jpan =false;
2424
letmut kore =false;
2525

26-
if ext ==ScriptExtension::Single(Script::Common) ||
27-
ext ==ScriptExtension::Single(Script::Inherited) ||
28-
ext.contains_script(Script::Han){
26+
if ext ==ScriptExtension::Single(Script::Common)
27+
|| ext ==ScriptExtension::Single(Script::Inherited)
28+
|| ext.contains_script(Script::Han)
29+
{
2930
hanb =true;
3031
jpan =true;
3132
kore =true;
@@ -44,7 +45,9 @@ impl From<ScriptExtension> for AugmentedScriptSet {
4445
}
4546
Self{
4647
base: ext,
47-
hanb, jpan, kore
48+
hanb,
49+
jpan,
50+
kore,
4851
}
4952
}
5053
}
@@ -74,7 +77,7 @@ impl Default for AugmentedScriptSet {
7477

7578
implAugmentedScriptSet{
7679
/// Intersect this set with another
77-
pubfnintersect_with(&mutself,other:Self){
80+
pubfnintersect_with(&mutself,other:Self){
7881
self.base.intersect_with(other.base);
7982
self.hanb =self.hanb && other.hanb;
8083
self.jpan =self.jpan && other.jpan;
@@ -83,13 +86,13 @@ impl AugmentedScriptSet {
8386

8487
/// Check if the set is empty
8588
pubfnis_empty(&self) ->bool{
86-
self.base.is_empty() && !self.hanb && !self.jpan && !self.kore
89+
self.base.is_empty() && !self.hanb && !self.jpan && !self.kore
8790
}
8891

8992
/// Check if the set is "All" (Common or Inherited)
9093
pubfnis_all(&self) ->bool{
91-
self.base ==ScriptExtension::Single(Script::Common) ||
92-
self.base ==ScriptExtension::Single(Script::Inherited)
94+
self.base ==ScriptExtension::Single(Script::Common)
95+
||self.base ==ScriptExtension::Single(Script::Inherited)
9396
}
9497

9598
/// Construct an AugmentedScriptSet for a given character

‎src/restriction_level.rs‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
//! a string conforms to
33
44
usecrate::mixed_script::AugmentedScriptSet;
5-
use unicode_script::{Script,ScriptExtension};
65
usecrate::GeneralSecurityProfile;
6+
use unicode_script::{Script,ScriptExtension};
77

88
#[derive(Copy,Clone,PartialEq,PartialOrd,Eq,Ord,Debug,Hash)]
99
/// The [Restriction level](https://www.unicode.org/reports/tr39/#Restriction_Level_Detection)
@@ -24,14 +24,13 @@ pub enum RestrictionLevel {
2424
}
2525

2626
/// Utilities for determining which [restriction level](https://www.unicode.org/reports/tr39/#Restriction_Level_Detection)
27-
/// a string satisfies
27+
/// a string satisfies
2828
pubtraitRestrictionLevelDetection:Sized{
2929
/// Detect the [restriction level](https://www.unicode.org/reports/tr39/#Restriction_Level_Detection)
3030
///
3131
/// This will _not_ check identifier well-formedness, as different applications may have different notions of well-formedness
3232
fndetect_restriction_level(self) ->RestrictionLevel;
3333

34-
3534
/// Check if a string satisfies the supplied [restriction level](https://www.unicode.org/reports/tr39/#Restriction_Level_Detection)
3635
///
3736
/// This will _not_ check identifier well-formedness, as different applications may have different notions of well-formedness
@@ -72,4 +71,4 @@ impl RestrictionLevelDetection for &'_ str {
7271
}
7372
returnRestrictionLevel::MinimallyRestrictive;
7473
}
75-
}
74+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp