File tree Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -146,17 +146,7 @@ pub async fn find_crate(
146146 )
147147 } ;
148148
149- let kws = if include. keywords {
150- Some (
151- CrateKeyword :: belonging_to ( & krate)
152- . inner_join ( keywords:: table)
153- . select ( Keyword :: as_select ( ) )
154- . load ( & mut conn)
155- . await ?,
156- )
157- } else {
158- None
159- } ;
149+ let kws = load_keywords ( & mut conn, & krate, include. keywords ) . await ?;
160150 let cats = if include. categories {
161151 Some (
162152 CrateCategory :: belonging_to ( & krate)
@@ -269,6 +259,22 @@ fn load_default_versions_and_publishers<'a>(
269259 . boxed ( )
270260}
271261
262+ fn load_keywords < ' a > (
263+ conn : & mut AsyncPgConnection ,
264+ krate : & ' a Crate ,
265+ includes : bool ,
266+ ) -> BoxFuture < ' a , AppResult < Option < Vec < Keyword > > > > {
267+ if !includes {
268+ return always_ready ( || Ok ( None ) ) . boxed ( ) ;
269+ }
270+
271+ let fut = CrateKeyword :: belonging_to ( & krate)
272+ . inner_join ( keywords:: table)
273+ . select ( Keyword :: as_select ( ) )
274+ . load ( conn) ;
275+ async move { Ok ( Some ( fut. await ?) ) } . boxed ( )
276+ }
277+
272278fn _load_versions_and_publishers < ' a > (
273279 conn : & mut AsyncPgConnection ,
274280 krate : & ' a Crate ,
You can’t perform that action at this time.
0 commit comments