rust-lang / crates.io

The Rust package registry
https://crates.io
Apache License 2.0
2.86k stars 585 forks source link

Use `#[diesel::dsl::auto_type]` in some places #8970

Closed weiznich closed 2 days ago

weiznich commented 4 days ago

This commit replaces some of the manual written type aliases by #[diesel::dsl::auto_type] which just generates the correct return type based on the function content. This hopefully removes some complexity from the database code.

The main motivation for this change is to update the diesel Composing Applications guide which is based on this code.

I'm not 100% happy with this as it's currently not possible to use #[auto_type] for all the the type defs due to the following reasons:

codecov[bot] commented 4 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.99%. Comparing base (2a321ff) to head (dd6eb3a). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #8970 +/- ## ========================================== - Coverage 89.00% 88.99% -0.02% ========================================== Files 277 277 Lines 27841 27845 +4 ========================================== - Hits 24781 24780 -1 - Misses 3060 3065 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.