@@ -4,7 +4,6 @@ use crate::web::axum_cached_redirect;
4
4
use crate :: web:: rustdoc:: RustdocHtmlParams ;
5
5
use crate :: {
6
6
impl_axum_webpage,
7
- repositories:: RepositoryStatsUpdater ,
8
7
storage:: PathNotFoundError ,
9
8
web:: {
10
9
cache:: CachePolicy ,
@@ -74,7 +73,6 @@ struct RepositoryMetadata {
74
73
forks : i32 ,
75
74
issues : i32 ,
76
75
name : Option < String > ,
77
- icon : & ' static str ,
78
76
}
79
77
80
78
fn optional_markdown < S > ( markdown : & Option < String > , serializer : S ) -> Result < S :: Ok , S :: Error >
@@ -104,7 +102,6 @@ impl CrateDetails {
104
102
name : & str ,
105
103
version : & str ,
106
104
version_or_latest : & str ,
107
- up : Option < & RepositoryStatsUpdater > ,
108
105
) -> Result < Option < CrateDetails > , anyhow:: Error > {
109
106
let krate = match sqlx:: query!(
110
107
r#"SELECT
@@ -168,12 +165,11 @@ impl CrateDetails {
168
165
// get releases, sorted by semver
169
166
let releases = releases_for_crate ( conn, krate. crate_id ) . await ?;
170
167
171
- let repository_metadata = krate. repo_host . map ( |host | RepositoryMetadata {
168
+ let repository_metadata = krate. repo_host . map ( |_ | RepositoryMetadata {
172
169
issues : krate. repo_issues . unwrap ( ) ,
173
170
stars : krate. repo_stars . unwrap ( ) ,
174
171
forks : krate. repo_forks . unwrap ( ) ,
175
172
name : krate. repo_name ,
176
- icon : up. map_or ( "code-branch" , |u| u. get_icon_name ( & host) ) ,
177
173
} ) ;
178
174
179
175
let metadata = MetaData {
@@ -386,7 +382,6 @@ pub(crate) async fn crate_details_handler(
386
382
Path ( params) : Path < CrateDetailHandlerParams > ,
387
383
Extension ( storage) : Extension < Arc < AsyncStorage > > ,
388
384
mut conn : DbConnection ,
389
- Extension ( repository_stats_updater) : Extension < Arc < RepositoryStatsUpdater > > ,
390
385
) -> AxumResult < AxumResponse > {
391
386
// this handler must always called with a crate name
392
387
if params. version . is_none ( ) {
@@ -413,15 +408,9 @@ pub(crate) async fn crate_details_handler(
413
408
}
414
409
} ;
415
410
416
- let mut details = CrateDetails :: new (
417
- & mut conn,
418
- & params. name ,
419
- & version,
420
- & version_or_latest,
421
- Some ( & repository_stats_updater) ,
422
- )
423
- . await ?
424
- . ok_or ( AxumNope :: VersionNotFound ) ?;
411
+ let mut details = CrateDetails :: new ( & mut conn, & params. name , & version, & version_or_latest)
412
+ . await ?
413
+ . ok_or ( AxumNope :: VersionNotFound ) ?;
425
414
426
415
match details. fetch_readme ( & storage) . await {
427
416
Ok ( readme) => details. readme = readme. or ( details. readme ) ,
@@ -712,7 +701,7 @@ mod tests {
712
701
expected_last_successful_build : Option < & str > ,
713
702
) -> Result < ( ) , Error > {
714
703
let mut conn = db. async_conn ( ) . await ;
715
- let details = CrateDetails :: new ( & mut conn, package, version, version, None )
704
+ let details = CrateDetails :: new ( & mut conn, package, version, version)
716
705
. await
717
706
. with_context ( || anyhow:: anyhow!( "could not fetch crate details" ) ) ?
718
707
. unwrap ( ) ;
@@ -880,7 +869,7 @@ mod tests {
880
869
881
870
let details = env. runtime ( ) . block_on ( async move {
882
871
let mut conn = db. async_conn ( ) . await ;
883
- CrateDetails :: new ( & mut conn, "foo" , "0.2.0" , "0.2.0" , None )
872
+ CrateDetails :: new ( & mut conn, "foo" , "0.2.0" , "0.2.0" )
884
873
. await
885
874
. unwrap ( )
886
875
. unwrap ( )
@@ -1001,7 +990,7 @@ mod tests {
1001
990
for version in & [ "0.0.1" , "0.0.2" , "0.0.3" ] {
1002
991
let details = env. runtime ( ) . block_on ( async move {
1003
992
let mut conn = db. async_conn ( ) . await ;
1004
- CrateDetails :: new ( & mut conn, "foo" , version, version, None )
993
+ CrateDetails :: new ( & mut conn, "foo" , version, version)
1005
994
. await
1006
995
. unwrap ( )
1007
996
. unwrap ( )
@@ -1031,7 +1020,7 @@ mod tests {
1031
1020
for version in & [ "0.0.1" , "0.0.2" , "0.0.3-pre.1" ] {
1032
1021
let details = env. runtime ( ) . block_on ( async move {
1033
1022
let mut conn = db. async_conn ( ) . await ;
1034
- CrateDetails :: new ( & mut conn, "foo" , version, version, None )
1023
+ CrateDetails :: new ( & mut conn, "foo" , version, version)
1035
1024
. await
1036
1025
. unwrap ( )
1037
1026
. unwrap ( )
@@ -1062,7 +1051,7 @@ mod tests {
1062
1051
for version in & [ "0.0.1" , "0.0.2" , "0.0.3" ] {
1063
1052
let details = env. runtime ( ) . block_on ( async move {
1064
1053
let mut conn = db. async_conn ( ) . await ;
1065
- CrateDetails :: new ( & mut conn, "foo" , version, version, None )
1054
+ CrateDetails :: new ( & mut conn, "foo" , version, version)
1066
1055
. await
1067
1056
. unwrap ( )
1068
1057
. unwrap ( )
@@ -1101,7 +1090,7 @@ mod tests {
1101
1090
for version in & [ "0.0.1" , "0.0.2" , "0.0.3" ] {
1102
1091
let details = env. runtime ( ) . block_on ( async move {
1103
1092
let mut conn = db. async_conn ( ) . await ;
1104
- CrateDetails :: new ( & mut conn, "foo" , version, version, None )
1093
+ CrateDetails :: new ( & mut conn, "foo" , version, version)
1105
1094
. await
1106
1095
. unwrap ( )
1107
1096
. unwrap ( )
@@ -1161,7 +1150,7 @@ mod tests {
1161
1150
1162
1151
let details = env. runtime ( ) . block_on ( async move {
1163
1152
let mut conn = db. async_conn ( ) . await ;
1164
- CrateDetails :: new ( & mut conn, "foo" , "0.0.1" , "0.0.1" , None )
1153
+ CrateDetails :: new ( & mut conn, "foo" , "0.0.1" , "0.0.1" )
1165
1154
. await
1166
1155
. unwrap ( )
1167
1156
. unwrap ( )
@@ -1187,7 +1176,7 @@ mod tests {
1187
1176
1188
1177
let details = env. runtime ( ) . block_on ( async move {
1189
1178
let mut conn = db. async_conn ( ) . await ;
1190
- CrateDetails :: new ( & mut conn, "foo" , "0.0.1" , "0.0.1" , None )
1179
+ CrateDetails :: new ( & mut conn, "foo" , "0.0.1" , "0.0.1" )
1191
1180
. await
1192
1181
. unwrap ( )
1193
1182
. unwrap ( )
@@ -1214,7 +1203,7 @@ mod tests {
1214
1203
1215
1204
let details = env. runtime ( ) . block_on ( async move {
1216
1205
let mut conn = db. async_conn ( ) . await ;
1217
- CrateDetails :: new ( & mut conn, "foo" , "0.0.1" , "0.0.1" , None )
1206
+ CrateDetails :: new ( & mut conn, "foo" , "0.0.1" , "0.0.1" )
1218
1207
. await
1219
1208
. unwrap ( )
1220
1209
. unwrap ( )
@@ -1236,7 +1225,7 @@ mod tests {
1236
1225
1237
1226
let details = env. runtime ( ) . block_on ( async move {
1238
1227
let mut conn = db. async_conn ( ) . await ;
1239
- CrateDetails :: new ( & mut conn, "foo" , "0.0.1" , "0.0.1" , None )
1228
+ CrateDetails :: new ( & mut conn, "foo" , "0.0.1" , "0.0.1" )
1240
1229
. await
1241
1230
. unwrap ( )
1242
1231
. unwrap ( )
@@ -1625,7 +1614,7 @@ mod tests {
1625
1614
1626
1615
let details = env. runtime ( ) . block_on ( async move {
1627
1616
let mut conn = env. async_db ( ) . await . async_conn ( ) . await ;
1628
- CrateDetails :: new ( & mut conn, "dummy" , "0.5.0" , "0.5.0" , None )
1617
+ CrateDetails :: new ( & mut conn, "dummy" , "0.5.0" , "0.5.0" )
1629
1618
. await
1630
1619
. unwrap ( )
1631
1620
. unwrap ( )
0 commit comments