The Encodable implementation can be simplified further in this case:
- The match is not necessary for a single possible type. Simply use the "dot" syntax.
- The return value of a closure can be derived automatically. `|enc| -> _ {` can be simplified to `|enc| {`.
- An explicit return is not necessary, simply leave an expression at the end of the scope.
- I'm not sure why `p_url` was dereferenced, but `p_type` not. Apparently it's not necessary at all.
- Some redundant braces can be removed.
- The match is not necessary for a single possible type. Simply use the "dot" syntax. - The return value of a closure can be derived automatically. `|enc| -> _ {` can be simplified to `|enc| {`. - An explicit return is not necessary, simply leave an expression at the end of the scope. - I'm not sure why `p_url` was dereferenced, but `p_type` not. Apparently it's not necessary at all. - Some redundant braces can be removed.
Before:
After: