Calculate the percentage of matched code, data, and functions.
(&mut self)
| 252 | |
| 253 | /// Calculate the percentage of matched code, data, and functions. |
| 254 | pub fn calc_matched_percent(&mut self) { |
| 255 | self.matched_code_percent = if self.total_code == 0 { |
| 256 | 100.0 |
| 257 | } else { |
| 258 | self.matched_code as f32 / self.total_code as f32 * 100.0 |
| 259 | }; |
| 260 | self.matched_data_percent = if self.total_data == 0 { |
| 261 | 100.0 |
| 262 | } else { |
| 263 | self.matched_data as f32 / self.total_data as f32 * 100.0 |
| 264 | }; |
| 265 | self.matched_functions_percent = if self.total_functions == 0 { |
| 266 | 100.0 |
| 267 | } else { |
| 268 | self.matched_functions as f32 / self.total_functions as f32 * 100.0 |
| 269 | }; |
| 270 | self.complete_code_percent = if self.total_code == 0 { |
| 271 | 100.0 |
| 272 | } else { |
| 273 | self.complete_code as f32 / self.total_code as f32 * 100.0 |
| 274 | }; |
| 275 | self.complete_data_percent = if self.total_data == 0 { |
| 276 | 100.0 |
| 277 | } else { |
| 278 | self.complete_data as f32 / self.total_data as f32 * 100.0 |
| 279 | }; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | impl From<&ReportItem> for ChangeItemInfo { |
no outgoing calls
no test coverage detected