Package: rust-x11rb-protocol / 0.13.1-2

gate-tests-on-std.patch Patch series | 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
diff --git a/src/connect.rs b/src/connect.rs
index 67e319e..82399c7 100644
--- a/src/connect.rs
+++ b/src/connect.rs
@@ -44,6 +44,8 @@ use core::fmt;
 /// to establish an X11 connection like so:
 ///
 /// ```rust,no_run
+/// # #[cfg(feature = "std")]
+/// # {
 /// # use x11rb_protocol::connect::Connect;
 /// # use x11rb_protocol::xauth::Family;
 /// # use std::{error::Error, io::prelude::*};
@@ -86,6 +88,7 @@ use core::fmt;
 /// let setup = connect.into_setup()?;
 /// # Ok(())
 /// # }
+/// # }
 /// ```
 ///
 /// If, instead, `stream` implements `AsyncRead` and `AsyncWrite`, the code
@@ -262,7 +265,7 @@ impl TryFrom<Connect> for Setup {
 }
 
 #[cfg(test)]
-#[cfg(feature = "extra-traits")]
+#[cfg(all(feature = "extra-traits", feature = "std"))]
 mod tests {
     use super::Connect;
     use crate::errors::ConnectError;
diff --git a/src/packet_reader.rs b/src/packet_reader.rs
index 1a3950e..a6ba090 100644
--- a/src/packet_reader.rs
+++ b/src/packet_reader.rs
@@ -124,7 +124,7 @@ fn extra_length(buffer: &[u8]) -> usize {
     }
 }
 
-#[cfg(test)]
+#[cfg(all(test, feature = "std"))]
 mod tests {
     use super::PacketReader;
     use alloc::{vec, vec::Vec};
diff --git a/src/parse_display/connect_instruction.rs b/src/parse_display/connect_instruction.rs
index cd3f6a8..5c9026c 100644
--- a/src/parse_display/connect_instruction.rs
+++ b/src/parse_display/connect_instruction.rs
@@ -54,7 +54,7 @@ pub(super) fn connect_addresses(p: &ParsedDisplay) -> impl Iterator<Item = Conne
     targets.into_iter()
 }
 
-#[cfg(test)]
+#[cfg(all(test, feature = "std"))]
 mod tests {
     // make sure iterator properties are clean
     use super::{super::parse_display, ConnectAddress};
diff --git a/src/parse_display/mod.rs b/src/parse_display/mod.rs
index f82feea..1160d2a 100644
--- a/src/parse_display/mod.rs
+++ b/src/parse_display/mod.rs
@@ -141,7 +141,7 @@ fn parse_display_direct_path(
     ))
 }
 
-#[cfg(test)]
+#[cfg(all(test, feature = "std"))]
 mod test {
     use super::{
         parse_display, parse_display_with_file_exists_callback, DisplayParsingError, ParsedDisplay,
diff --git a/src/test.rs b/src/test.rs
index 2e26e38..510fd14 100644
--- a/src/test.rs
+++ b/src/test.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 use std::borrow::Cow;
 
 use crate::protocol::{get_request_name, request_name};
diff --git a/src/wrapper.rs b/src/wrapper.rs
index 6e6f27b..beeefed 100644
--- a/src/wrapper.rs
+++ b/src/wrapper.rs
@@ -41,7 +41,7 @@ where
     }
 
     fn size_hint(&self) -> (usize, Option<usize>) {
-        let size = self.0.len() / core::mem::size_of::<T>();
+        let size = self.0.len() / size_of::<T>();
         (size, Some(size))
     }
 }
diff --git a/src/x11_utils.rs b/src/x11_utils.rs
index 945a684..611cacb 100644
--- a/src/x11_utils.rs
+++ b/src/x11_utils.rs
@@ -386,7 +386,7 @@ implement_serialize!(i64: 8);
 forward_float!(f32: u32);
 forward_float!(f64: u64);
 
-#[cfg(test)]
+#[cfg(all(test, feature = "std"))]
 mod float_tests {
     use super::{Serialize, TryParse};