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

tamada / oinkie / 28905197687

07 Jul 2026 11:13PM UTC coverage: 74.24% (+0.5%) from 73.696%
28905197687

push

github

web-flow
Merge pull request #17 from tamada/fable5/dead-code

refactor: remove unimplemented!() stubs and commented-out code (tech debt)

1611 of 2170 relevant lines covered (74.24%)

12.31 hits per line

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

75.81
/src/program.rs
1
use std::path::{Path, PathBuf};
2

3
use rustc_hash::FxHashMap;
4
use serde::{Deserialize, Serialize};
5

6
use crate::Iterable;
7

8
#[derive(Debug, Serialize, Deserialize)]
9
pub struct Program<T> {
10
    #[serde(rename = "program")]
11
    name: String,
12
    path: PathBuf,
13
    symbols: FxHashMap<String, String>,
14
    functions: Vec<Function<T>>,
15
    #[serde(skip)]
16
    pub json_path: Option<PathBuf>,
17
}
18

19
impl<T> crate::prelude::CsvInfo for Program<T> {
20
    fn csv_info(&self) -> String {
2✔
21
        let json_path = self.json_path.as_ref().map(|p| p.display().to_string()).unwrap_or_default();
2✔
22
        format!("program,{},{},{},{},{}",
2✔
23
            crate::compare::escape_csv_string(&self.name),
2✔
24
            crate::compare::escape_csv_string(&self.path.display().to_string()),
2✔
25
            self.symbols.len(), self.functions.len(),
2✔
26
            crate::compare::escape_csv_string(&json_path))
2✔
27
    }
2✔
28
    
29
    fn names(&self) -> Vec<String> {
2✔
30
        self.functions.iter().map(|f| f.name.clone()).collect()
2✔
31
    }
2✔
32
}
33

34
impl<T> Program<T> {
35
    pub fn set_json_path(&mut self, path: PathBuf) {
2✔
36
        self.json_path = Some(path);
2✔
37
    }
2✔
38

39
    pub fn new(name: String, path: PathBuf, symbols: FxHashMap<String, String>, functions: Vec<Function<T>>) -> Self {
×
40
        Self { name, path, symbols, functions, json_path: None }
×
41
    }
×
42

43
    pub fn name(&self) -> &str {
1✔
44
        &self.name
1✔
45
    }
1✔
46

47
    pub fn len(&self) -> usize {
33✔
48
        self.functions.len()
33✔
49
    }
33✔
50

51
    pub fn is_empty(&self) -> bool {
×
52
        self.functions.is_empty()
×
53
    }
×
54

55
    pub fn path(&self) -> &Path {
71✔
56
        &self.path
71✔
57
    }
71✔
58

59
    pub fn symbols(&self) -> impl Iterator<Item = (&str, &str)> {
×
60
        self.symbols.iter().map(|(k, v)| (k.as_str(), v.as_str()))
×
61
    }
×
62

63
    pub fn symbol(&self, addr: &str) -> Option<&String> {
13✔
64
        self.symbols.get(addr)
13✔
65
    }
13✔
66
}
67

68
impl<T> Iterable for &Program<T> {
69
    type Item = Function<T>;
70
    fn iter(&self) -> Box<dyn Iterator<Item = &Self::Item> + '_> {
32✔
71
        Box::new(self.functions.iter())
32✔
72
    }
32✔
73
}
74

75
impl<T> Iterable for Program<T> {
76
    type Item = Function<T>;
77
    fn iter(&self) -> Box<dyn Iterator<Item = &Self::Item> + '_> {
69✔
78
        Box::new(self.functions.iter())
69✔
79
    }
69✔
80
}
81

82
#[derive(Debug, Serialize, Deserialize)]
83
pub struct Function<T> {
84
    name: String,
85
    ops: Vec<T>
86
}
87

88
impl<T: crate::Op> Function<T> {
89
    pub fn name(&self) -> &str {
69✔
90
        &self.name
69✔
91
    }
69✔
92

93
    pub fn iter(&self) -> impl Iterator<Item = &T> {
13✔
94
        self.ops.iter()
13✔
95
    }
13✔
96

97
    pub fn get(&self, index: usize) -> Option<&T> {
2✔
98
        self.ops.get(index)
2✔
99
    }
2✔
100

101
    pub fn ops(&self) -> impl Iterator<Item = &str> {
87✔
102
        self.ops.iter().map(|op| op.mnemonic())
348✔
103
    }
87✔
104

105
    pub fn is_empty(&self) -> bool {
×
106
        self.ops.is_empty()
×
107
    }
×
108

109
    pub fn len(&self) -> usize {
×
110
        self.ops.len()
×
111
    }
×
112

113
    pub fn ops_freq(&self) -> rustc_hash::FxHashMap<String, usize> {
26✔
114
        crate::extractor::seq_to_freq(self.ops().map(|s| s.to_string()))
104✔
115
    }
26✔
116
}
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