Closed TedDriggs closed 5 years ago
Hmm Maybe i'll use a combination of 1 and 2,
because I still want that #[logfn(INFO)]
will work on Results too.
On the other hand, it will work even without matching through it just like Ok(T)
Err(E)
.
I'll need to think about this a bit
I've got a fix for this; going to put up a PR now.
Currently,
Result
detection looks to see if the first term in the path== "Result"
. This is brittle, as the code below demonstrates:This means functions that return mod-specific
Result
types such asio::Result
orfmt::Result
won't have the correct log level.Unfortunately, there's no good way to tell if a particular type is an alias of
Result
. This leaves three options for how to proceed:Result
. This would catch most cases.err
and/orok
are specified. Since these don't make sense to use otherwise, this is a lightweight way to solve the problem.Result
behavior. This approach preserves compatibility with existing attribute usage, but at the expense of conciseness.