Skip to content

Commit 46718bb

Browse files
authored
Add non_exhaustive to most marker types (#6401)
Fixes #4673 <!-- Thank you for your pull request to ICU4X! Reminder: try to use [Conventional Comments](https://conventionalcomments.org/) to make comments clearer. Please see https://github.com/unicode-org/icu4x/blob/main/CONTRIBUTING.md for general information on contributing to ICU4X. -->
1 parent 6ad6fa4 commit 46718bb

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

components/segmenter/src/line.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,7 @@ impl<'l, 's, Y: LineBreakType<'l, 's>> LineBreakIterator<'l, 's, Y> {
10651065
}
10661066

10671067
#[derive(Debug)]
1068+
#[non_exhaustive]
10681069
pub struct LineBreakTypeUtf8;
10691070

10701071
impl crate::private::Sealed for LineBreakTypeUtf8 {}
@@ -1099,6 +1100,7 @@ impl<'l, 's> LineBreakType<'l, 's> for LineBreakTypeUtf8 {
10991100
}
11001101

11011102
#[derive(Debug)]
1103+
#[non_exhaustive]
11021104
pub struct LineBreakTypePotentiallyIllFormedUtf8;
11031105

11041106
impl crate::private::Sealed for LineBreakTypePotentiallyIllFormedUtf8 {}
@@ -1186,6 +1188,7 @@ where
11861188
}
11871189

11881190
#[derive(Debug)]
1191+
#[non_exhaustive]
11891192
pub struct LineBreakTypeLatin1;
11901193
impl crate::private::Sealed for LineBreakTypeLatin1 {}
11911194

@@ -1217,6 +1220,7 @@ impl<'s> LineBreakType<'_, 's> for LineBreakTypeLatin1 {
12171220
}
12181221

12191222
#[derive(Debug)]
1223+
#[non_exhaustive]
12201224
pub struct LineBreakTypeUtf16;
12211225
impl crate::private::Sealed for LineBreakTypeUtf16 {}
12221226

components/segmenter/src/rule_segmenter.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ impl<'l, 's, Y: RuleBreakType<'l, 's> + ?Sized> RuleBreakIterator<'l, 's, Y> {
263263
}
264264

265265
#[derive(Debug)]
266+
#[non_exhaustive]
266267
pub struct RuleBreakTypeUtf8;
267268

268269
impl crate::private::Sealed for RuleBreakTypeUtf8 {}
@@ -284,6 +285,7 @@ impl<'s> RuleBreakType<'_, 's> for RuleBreakTypeUtf8 {
284285
}
285286

286287
#[derive(Debug)]
288+
#[non_exhaustive]
287289
pub struct RuleBreakTypePotentiallyIllFormedUtf8;
288290

289291
impl crate::private::Sealed for RuleBreakTypePotentiallyIllFormedUtf8 {}
@@ -305,6 +307,7 @@ impl<'s> RuleBreakType<'_, 's> for RuleBreakTypePotentiallyIllFormedUtf8 {
305307
}
306308

307309
#[derive(Debug)]
310+
#[non_exhaustive]
308311
pub struct RuleBreakTypeLatin1;
309312

310313
impl crate::private::Sealed for RuleBreakTypeLatin1 {}
@@ -326,6 +329,7 @@ impl<'s> RuleBreakType<'_, 's> for RuleBreakTypeLatin1 {
326329
}
327330

328331
#[derive(Debug)]
332+
#[non_exhaustive]
329333
pub struct RuleBreakTypeUtf16;
330334

331335
impl crate::private::Sealed for RuleBreakTypeUtf16 {}

components/segmenter/src/word.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ impl WordSegmenter {
548548
}
549549

550550
#[derive(Debug)]
551+
#[non_exhaustive]
551552
pub struct WordBreakTypeUtf8;
552553
impl crate::private::Sealed for WordBreakTypeUtf8 {}
553554

@@ -568,6 +569,7 @@ impl<'l, 's> RuleBreakType<'l, 's> for WordBreakTypeUtf8 {
568569
}
569570

570571
#[derive(Debug)]
572+
#[non_exhaustive]
571573
pub struct WordBreakTypePotentiallyIllFormedUtf8;
572574
impl crate::private::Sealed for WordBreakTypePotentiallyIllFormedUtf8 {}
573575

@@ -643,6 +645,7 @@ where
643645
}
644646

645647
#[derive(Debug)]
648+
#[non_exhaustive]
646649
pub struct WordBreakTypeUtf16;
647650

648651
impl crate::private::Sealed for WordBreakTypeUtf16 {}

provider/core/src/buf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub use self::serde::*;
1515
///
1616
/// The data is expected to be deserialized before it can be used; see
1717
/// [`DataPayload::into_deserialized`].
18-
#[allow(clippy::exhaustive_structs)] // marker type
18+
#[non_exhaustive]
1919
#[derive(Debug)]
2020
pub struct BufferMarker;
2121

provider/core/src/marker.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ pub use __data_marker_id as data_marker_id;
560560
macro_rules! data_marker {
561561
($(#[$doc:meta])* $name:ident, $($debug:literal,)? $struct:ty $(, $(#[$meta:meta])* $info_field:ident = $info_val:expr)* $(,)?) => {
562562
$(#[$doc])*
563+
#[non_exhaustive]
563564
pub struct $name;
564565
impl $crate::DynamicDataMarker for $name {
565566
type DataStruct = $struct;

0 commit comments

Comments
 (0)