File: fix-no-default-features-tests.patch

package info (click to toggle)
rust-guid-create 0.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 176 kB
  • sloc: sh: 36; makefile: 2
file content (48 lines) | stat: -rw-r--r-- 1,640 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Description: add feature gates to tests for no-default-features compatibility
 The crate fails to build when tested with --no-default-features despite
 advertising no_std support. This patch adds conditional compilation to
 tests that require std and rand features, allowing minimal feature builds
 to succeed by skipping incompatible tests rather than failing compilation
Author: Nadzeya Hutsko <nadzya.info@gmail.com>
Bug: https://github.com/kurtlawrence/guid-create/issues/25
Last-Update: 2025-11-07
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -372,7 +372,7 @@
 #[cfg(feature = "serde")]
 use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
 
-#[cfg(feature = "serde")]
+#[cfg(all(feature = "serde", feature = "std"))]
 impl<'de> Deserialize<'de> for GUID {
     fn deserialize<D>(deserializer: D) -> Result<GUID, D::Error>
     where
@@ -385,7 +385,7 @@
     }
 }
 
-#[cfg(feature = "serde")]
+#[cfg(all(feature = "serde", feature = "std"))]
 impl Serialize for GUID {
     fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
         serializer.serialize_str(&*self.to_string())
@@ -424,7 +424,7 @@
     fn travis_test() {}
 
     #[test]
-    #[cfg(feature = "std")]
+    #[cfg(all(feature = "std", feature = "rand"))]
     fn string_lengths() {
         for _ in 0..10000 {
             let guid = GUID::rand();
@@ -490,7 +490,7 @@
     }
 
     #[test]
-    #[cfg(feature = "std")]
+    #[cfg(all(feature = "std", feature = "rand"))]
     fn parse_strings() {
         for _ in 0..10000 {
             let guid = GUID::rand();