Skip to content

Commit b03dc78

Browse files
Replace unmaintained unic-ucd-category crate with icu_properties (astral-sh#24344)
Co-authored-by: Micha Reiser <micha@reiser.io>
1 parent 68483b3 commit b03dc78

4 files changed

Lines changed: 46 additions & 88 deletions

File tree

‎Cargo.lock‎

Lines changed: 30 additions & 83 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ hashbrown = { version = "0.16.0", default-features = false, features = [
108108
"inline-more",
109109
] }
110110
heck = "0.5.0"
111+
icu_properties = { version = "2.1.2" }
111112
ignore = { version = "0.4.24" }
112113
imara-diff = { version = "0.2.0" }
113114
imperative = { version = "1.0.4" }
@@ -199,7 +200,6 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
199200
] }
200201
tryfn = { version = "1.0.0" }
201202
typed-arena = { version = "2.0.2" }
202-
unic-ucd-category = { version = "0.9" }
203203
unicode-ident = { version = "1.0.12" }
204204
unicode-normalization = { version = "0.1.23" }
205205
unicode-width = { version = "0.2.0" }

‎crates/ruff_python_literal/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ doctest = false
1818
ruff_python_ast = { workspace = true }
1919

2020
bitflags = { workspace = true }
21+
icu_properties = { workspace = true }
2122
itertools = { workspace = true }
22-
unic-ucd-category = { workspace = true }
2323

2424
[dev-dependencies]
2525

‎crates/ruff_python_literal/src/char.rs‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use unic_ucd_category::GeneralCategory;
1+
use icu_properties::props::{EnumeratedProperty, GeneralCategory};
22

33
/// According to python following categories aren't printable:
44
/// * Cc (Other, Control)
@@ -10,6 +10,17 @@ use unic_ucd_category::GeneralCategory;
1010
/// * Zp Separator, Paragraph ('\u2029', PARAGRAPH SEPARATOR)
1111
/// * Zs (Separator, Space) other than ASCII space('\x20').
1212
pub fn is_printable(c: char) -> bool {
13-
let cat = GeneralCategory::of(c);
14-
!(cat.is_other() || cat.is_separator())
13+
let cat = GeneralCategory::for_char(c);
14+
15+
!matches!(
16+
cat,
17+
GeneralCategory::Control
18+
| GeneralCategory::Format
19+
| GeneralCategory::Surrogate
20+
| GeneralCategory::PrivateUse
21+
| GeneralCategory::Unassigned
22+
| GeneralCategory::LineSeparator
23+
| GeneralCategory::ParagraphSeparator
24+
| GeneralCategory::SpaceSeparator
25+
)
1526
}

0 commit comments

Comments
 (0)