chshersh / tool-sync

🧰 Download pre-built binaries of all your favourite tools with a single command
https://crates.io/crates/tool-sync
Mozilla Public License 2.0
69 stars 16 forks source link

Refactor custom 'display()' functions to use the 'Display' trait #88

Closed chshersh closed 1 year ago

chshersh commented 1 year ago

See the discussion in #83

The idea is to implement the std::fmt::Display trait for data types where we already use a custom display() function. Specifically:

Implementation example:

enum TestEnum {
    Var1(String),
    Var2(String),
}

impl fmt::Display for TestEnum {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            TestEnum::Var1(s) => write!(f, "[VAR1]: {}", s),
            TestEnum::Var2(s) => write!(f, "[VAR2]: {}", s),
        }
    }
}
zixuan-x commented 1 year ago

Sicne I just worked with implementing Display trait, this issue is probably a good one for me to get more familiar with the code base. If it's not taken then I'll start working on it?

chshersh commented 1 year ago

@zixuanzhang-x Sounds like an excellent next issue 🥇

It's not taken. And I think @MitchellBerend will be really pleased when this one is done so we can unlock: