Skip to content

Commit c2d8f92

Browse files
feat: add test feature for typed-uuid's new_unchecked method
1 parent 4d0c239 commit c2d8f92

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

benzina/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ serde = ["dep:serde", "uuid?/serde"]
3636
utoipa = ["dep:utoipa"]
3737

3838
example-generated = ["typed-uuid"]
39+
test = ["typed-uuid"]
3940

4041
[lints]
4142
workspace = true

benzina/src/typed_uuid.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
/// ```
6565
///
6666
/// [^See note]: There is no way in normal usage to construct an instance. The exception is with the
67-
/// `new_unchecked` method, which is intended for special cases, such as testing.
67+
/// `new_unchecked` method, which is gated behind the `test` feature and intended for special cases
68+
/// (including testing).
6869
#[macro_export]
6970
macro_rules! typed_uuid {
7071
(
@@ -93,6 +94,7 @@ macro_rules! typed_uuid {
9394
impl $name {
9495
/// Creates a new, unchecked typed Uuid
9596
#[must_use]
97+
#[cfg(feature = "test")]
9698
pub fn new_unchecked(inner: ::uuid::Uuid) -> Self {
9799
Self(inner)
98100
}

0 commit comments

Comments
 (0)