We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
EntitySet
1 parent dfbe997 commit 23a410eCopy full SHA for 23a410e
1 file changed
cranelift/entity/src/set.rs
@@ -29,7 +29,7 @@ where
29
K: fmt::Debug + EntityRef,
30
{
31
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32
- f.debug_set().entries(self.keys()).finish()
+ f.debug_set().entries(self.iter()).finish()
33
}
34
35
@@ -199,7 +199,7 @@ where
199
#[cfg(test)]
200
mod tests {
201
use super::*;
202
- use alloc::vec::Vec;
+ use alloc::{format, vec::Vec};
203
use core::u32;
204
205
// `EntityRef` impl for testing.
@@ -307,4 +307,13 @@ mod tests {
307
308
assert!(m.is_empty());
309
310
+
311
+ #[test]
312
+ fn fmt_debug() {
313
+ let mut s = EntitySet::new();
314
+ s.insert(E(2));
315
+ s.insert(E(4));
316
+ // The `Debug` formatting should only show the elements within the set.
317
+ assert_eq!(format!("{s:?}"), "{E(2), E(4)}");
318
+ }
319
0 commit comments