• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

demosdemon / git-remote-codecommit / 18610141464

18 Oct 2025 03:29AM UTC coverage: 93.867% (-1.0%) from 94.844%
18610141464

push

github

demosdemon
feat: simplify hex-display

14 of 15 new or added lines in 1 file covered. (93.33%)

2 existing lines in 1 file now uncovered.

704 of 750 relevant lines covered (93.87%)

425.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/crates/git-remote-codecommit/src/hex.rs
1
pub struct HexDisplay([u8; 32]);
2

3
impl core::fmt::Debug for HexDisplay {
UNCOV
4
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
×
NEW
5
        std::fmt::Display::fmt(self, f)
×
UNCOV
6
    }
×
7
}
8

9
impl core::fmt::Display for HexDisplay {
10
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
374✔
11
        const CHARSET: &[u8; 16] = b"0123456789abcdef";
12

13
        let mut buf = [0u8; 64];
374✔
14
        // SAFETY: 64 is evenly divisible by 2
15
        unsafe { buf.as_chunks_unchecked_mut::<2>() }
374✔
16
            .iter_mut()
374✔
17
            .zip(self.0.as_ref())
374✔
18
            .for_each(|(slot, &byte)| {
11,968✔
19
                slot[0] = CHARSET[(byte >> 4) as usize];
11,968✔
20
                slot[1] = CHARSET[(byte & 0x0F) as usize];
11,968✔
21
            });
11,968✔
22

23
        // SAFETY: buf only contains valid ASCII hex characters
24
        let buf = unsafe { core::str::from_utf8_unchecked(&buf) };
374✔
25

26
        f.pad(buf)
374✔
27
    }
374✔
28
}
29

30
pub trait HexDisplayExt {
31
    fn hex_display(self) -> HexDisplay;
32
}
33

34
impl<T: Into<[u8; 32]>> HexDisplayExt for T {
35
    fn hex_display(self) -> HexDisplay {
374✔
36
        HexDisplay(self.into())
374✔
37
    }
374✔
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc