artichoke / strftime-ruby

⏳ Ruby `Time#strftime` parser and formatter
https://crates.io/crates/strftime-ruby
MIT License
12 stars 0 forks source link

Provide a std::io::Write strftime implementation #49

Closed x-hgg-x closed 2 years ago

x-hgg-x commented 2 years ago

I think the Error::source() implementation of strftime::Error is not necessary, since we can already match the error and extract the inner value in all cases.

lopopolo commented 2 years ago

I think the Error::source() implementation of strftime::Error is not necessary, since we can already match the error and extract the inner value in all cases.

The Error::source implementation is not for when you have a strftime::Error, but when you have a Box<dyn Error> that happens to be a strftime::Error.

I think we should also add the Error::IoError case to the existing source impl.

To provide some more context, a crate like eyre collects dyn Errors into a report type and reports the chain of error causes: https://docs.rs/eyre/latest/eyre/. This is only possible if we implement the Error::source method.

x-hgg-x commented 2 years ago

There is one more missed line since I removed derive implementations for strftime::Error. The Code Coverage check is not required, so this should not block the merge.