77use crate :: app:: AppState ;
88use crate :: controllers:: helpers:: pagination:: PaginationOptions ;
99use crate :: models:: {
10- Category , Crate , CrateCategory , CrateKeyword , CrateVersions , Keyword , RecentCrateDownloads ,
11- User , Version , VersionOwnerAction ,
10+ Category , Crate , CrateCategory , CrateKeyword , CrateName , CrateVersions , Keyword ,
11+ RecentCrateDownloads , User , Version , VersionOwnerAction ,
1212} ;
1313use crate :: schema:: * ;
1414use crate :: tasks:: spawn_blocking;
@@ -63,7 +63,7 @@ pub async fn show(app: AppState, Path(name): Path<String>, req: Parts) -> AppRes
6363 let mut versions_and_publishers: Vec < ( Version , Option < User > ) > = krate
6464 . all_versions ( )
6565 . left_outer_join ( users:: table)
66- . select ( ( versions :: all_columns , users :: all_columns . nullable ( ) ) )
66+ . select ( < ( Version , Option < User > ) > :: as_select ( ) )
6767 . load ( conn) ?;
6868 versions_and_publishers. sort_by_cached_key ( |( version, _) | {
6969 Reverse ( semver:: Version :: parse ( & version. num ) . ok ( ) )
@@ -92,7 +92,7 @@ pub async fn show(app: AppState, Path(name): Path<String>, req: Parts) -> AppRes
9292 Some (
9393 CrateKeyword :: belonging_to ( & krate)
9494 . inner_join ( keywords:: table)
95- . select ( keywords :: all_columns )
95+ . select ( Keyword :: as_select ( ) )
9696 . load ( conn) ?,
9797 )
9898 } else {
@@ -102,7 +102,7 @@ pub async fn show(app: AppState, Path(name): Path<String>, req: Parts) -> AppRes
102102 Some (
103103 CrateCategory :: belonging_to ( & krate)
104104 . inner_join ( categories:: table)
105- . select ( categories :: all_columns )
105+ . select ( Category :: as_select ( ) )
106106 . load ( conn) ?,
107107 )
108108 } else {
@@ -260,15 +260,11 @@ pub async fn reverse_dependencies(
260260
261261 let version_ids: Vec < i32 > = rev_deps. iter ( ) . map ( |dep| dep. version_id ) . collect ( ) ;
262262
263- let versions_and_publishers: Vec < ( Version , String , Option < User > ) > = versions:: table
263+ let versions_and_publishers: Vec < ( Version , CrateName , Option < User > ) > = versions:: table
264264 . filter ( versions:: id. eq_any ( version_ids) )
265265 . inner_join ( crates:: table)
266266 . left_outer_join ( users:: table)
267- . select ( (
268- versions:: all_columns,
269- crates:: name,
270- users:: all_columns. nullable ( ) ,
271- ) )
267+ . select ( <( Version , CrateName , Option < User > ) >:: as_select ( ) )
272268 . load ( conn) ?;
273269 let versions = versions_and_publishers
274270 . iter ( )
@@ -279,7 +275,7 @@ pub async fn reverse_dependencies(
279275 . into_iter ( )
280276 . zip ( actions)
281277 . map ( |( ( version, krate_name, published_by) , actions) | {
282- EncodableVersion :: from ( version, & krate_name, published_by, actions)
278+ EncodableVersion :: from ( version, & krate_name. name , published_by, actions)
283279 } )
284280 . collect :: < Vec < _ > > ( ) ;
285281
0 commit comments