Skip to content

fix: Misleading output when initialising ETA with 0 tasks_count #17

@K-dizzled

Description

@K-dizzled

Describe the bug
Misleading output: With a tasks_count of 0, the output produced by the Display implementation for Eta will be misleading. It might show progress as NaN% or an incorrect percentage, and the remaining time might also be incorrect.

To Reproduce
Steps to reproduce the behavior:

  1. Write the following code:
use eta;
fn main () {
        let eta = Eta::new(0, TimeAcc::SEC);
        println!("Eta: {}", eta);
}
  1. run cargo build

Resultant behavior

Eta: 0 0 0
0
0/0: NaN% (0s remaining)

Expected behavior
No possibility to create ETA with 0 tasks_count or:
Eta: 0 0 0
0
0/0: 0% (0s remaining)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions