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

rust-lang / annotate-snippets-rs / 13903310413

17 Mar 2025 03:26PM UTC coverage: 85.793%. Remained the same
13903310413

Pull #185

github

web-flow
Merge 34a69b497 into 5c6ce17f3
Pull Request #185: refactor(display-list): split into separate modules (#184)

636 of 729 new or added lines in 6 files covered. (87.24%)

779 of 908 relevant lines covered (85.79%)

4.62 hits per line

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

94.12
/src/renderer/display/cursor_line.rs
1
use super::end_line::EndLine;
2

3
pub(crate) struct CursorLines<'a>(&'a str);
4

5
impl CursorLines<'_> {
6
    pub(crate) fn new(src: &str) -> CursorLines<'_> {
4✔
7
        CursorLines(src)
8
    }
9
}
10

11
impl<'a> Iterator for CursorLines<'a> {
12
    type Item = (&'a str, EndLine);
13

14
    fn next(&mut self) -> Option<Self::Item> {
5✔
15
        if self.0.is_empty() {
4✔
16
            None
5✔
17
        } else {
18
            self.0
5✔
19
                .find('\n')
20
                .map(|x| {
4✔
21
                    let ret = if 0 < x {
6✔
22
                        if self.0.as_bytes()[x - 1] == b'\r' {
14✔
23
                            (&self.0[..x - 1], EndLine::Crlf)
4✔
24
                        } else {
25
                            (&self.0[..x], EndLine::Lf)
4✔
26
                        }
27
                    } else {
28
                        ("", EndLine::Lf)
3✔
29
                    };
30
                    self.0 = &self.0[x + 1..];
7✔
31
                    ret
5✔
32
                })
33
                .or_else(|| {
3✔
34
                    let ret = Some((self.0, EndLine::Eof));
5✔
35
                    self.0 = "";
3✔
NEW
36
                    ret
×
37
                })
38
        }
39
    }
40
}
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