Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions cranelift/entity/src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ where
K: fmt::Debug + EntityRef,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_set().entries(self.keys()).finish()
f.debug_set().entries(self.iter()).finish()
}
}

Expand Down Expand Up @@ -199,7 +199,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use alloc::vec::Vec;
use alloc::{format, vec::Vec};
use core::u32;

// `EntityRef` impl for testing.
Expand Down Expand Up @@ -307,4 +307,13 @@ mod tests {

assert!(m.is_empty());
}

#[test]
fn fmt_debug() {
let mut s = EntitySet::new();
s.insert(E(2));
s.insert(E(4));
// The `Debug` formatting should only show the elements within the set.
assert_eq!(format!("{s:?}"), "{E(2), E(4)}");
}
}
Loading