Skip to content

Commit 3c465c9

Browse files
constify property names constructors (#7294)
Baked constructors should be `const`.
1 parent 9aef9ef commit 3c465c9

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Add `IndicConjunctBreak` (unicode-org#7280)
99
- Add conversion between `icu::properties::props::Script` and `icu::locale::subtags:Script` (unicode-org#7270)
1010
- Add conversion between `icu::properties::props::BidiClass` and `unicode_bidi::BidiClass` (unicode-org#7272)
11+
- Constify `PropertyNamesLong`/`PropertNamesShort`/`PropertyParser` constructors (unicode-org#7294)
1112
- Utils
1213
- Retire the `icu_harfbuzz` crate. The `icu_properties` and `icu_normalizer` types now directly implement the `harfbuzz-traits`
1314

components/properties/src/names.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<T> PropertyParser<T> {
8686
/// [📚 Help choosing a constructor](icu_provider::constructors)
8787
#[cfg(feature = "compiled_data")]
8888
#[expect(clippy::new_ret_no_self)]
89-
pub fn new() -> PropertyParserBorrowed<'static, T>
89+
pub const fn new() -> PropertyParserBorrowed<'static, T>
9090
where
9191
T: ParseableEnumeratedProperty,
9292
{
@@ -255,7 +255,7 @@ impl<T: TrieValue> PropertyParserBorrowed<'static, T> {
255255
///
256256
/// [📚 Help choosing a constructor](icu_provider::constructors)
257257
#[cfg(feature = "compiled_data")]
258-
pub fn new() -> Self
258+
pub const fn new() -> Self
259259
where
260260
T: ParseableEnumeratedProperty,
261261
{
@@ -383,7 +383,7 @@ impl<T: NamedEnumeratedProperty> PropertyNamesLong<T> {
383383
/// [📚 Help choosing a constructor](icu_provider::constructors)
384384
#[cfg(feature = "compiled_data")]
385385
#[expect(clippy::new_ret_no_self)]
386-
pub fn new() -> PropertyNamesLongBorrowed<'static, T> {
386+
pub const fn new() -> PropertyNamesLongBorrowed<'static, T> {
387387
PropertyNamesLongBorrowed::new()
388388
}
389389

@@ -447,7 +447,7 @@ impl<T: NamedEnumeratedProperty> PropertyNamesLongBorrowed<'static, T> {
447447
///
448448
/// [📚 Help choosing a constructor](icu_provider::constructors)
449449
#[cfg(feature = "compiled_data")]
450-
pub fn new() -> Self {
450+
pub const fn new() -> Self {
451451
Self {
452452
map: T::SINGLETON_LONG,
453453
}
@@ -516,7 +516,7 @@ impl<T: NamedEnumeratedProperty> PropertyNamesShort<T> {
516516
/// [📚 Help choosing a constructor](icu_provider::constructors)
517517
#[cfg(feature = "compiled_data")]
518518
#[expect(clippy::new_ret_no_self)]
519-
pub fn new() -> PropertyNamesShortBorrowed<'static, T> {
519+
pub const fn new() -> PropertyNamesShortBorrowed<'static, T> {
520520
PropertyNamesShortBorrowed::new()
521521
}
522522

@@ -620,7 +620,7 @@ impl<T: NamedEnumeratedProperty> PropertyNamesShortBorrowed<'static, T> {
620620
///
621621
/// [📚 Help choosing a constructor](icu_provider::constructors)
622622
#[cfg(feature = "compiled_data")]
623-
pub fn new() -> Self {
623+
pub const fn new() -> Self {
624624
Self {
625625
map: T::SINGLETON_SHORT,
626626
}

0 commit comments

Comments
 (0)