File tree Expand file tree Collapse file tree 4 files changed +12
-4
lines changed
Expand file tree Collapse file tree 4 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,14 @@ exclude = [
1515 " .rustwide-docker" ,
1616]
1717
18+ [features ]
19+ consistency_check = [" crates-index" ]
20+
1821[dependencies ]
1922log = " 0.4"
2023regex = " 1"
2124structopt = " 0.3"
22- crates-index = " 0.15.1"
25+ crates-index = { version = " 0.15.1" , optional = true }
2326crates-index-diff = " 7.1.1"
2427reqwest = { version = " 0.10.6" , features = [" blocking" , " json" ] } # TODO: Remove blocking when async is ready
2528semver = { version = " 0.9" , features = [" serde" ] }
Original file line number Diff line number Diff line change @@ -404,6 +404,7 @@ enum DatabaseSubcommand {
404404 } ,
405405
406406 /// Compares the database with the index and resolves inconsistencies
407+ #[ cfg( feature = "consistency_check" ) ]
407408 Synchronize {
408409 /// Don't actually resolve the inconsistencies, just log them
409410 #[ structopt( long) ]
@@ -455,6 +456,7 @@ impl DatabaseSubcommand {
455456 . context ( "failed to delete the crate" ) ?,
456457 Self :: Blacklist { command } => command. handle_args ( ctx) ?,
457458
459+ #[ cfg( feature = "consistency_check" ) ]
458460 Self :: Synchronize { dry_run } => {
459461 docs_rs:: utils:: consistency:: run_check ( & mut * ctx. conn ( ) ?, & * ctx. index ( ) ?, dry_run) ?;
460462 }
Original file line number Diff line number Diff line change @@ -2,11 +2,12 @@ use std::{path::PathBuf, process::Command};
22
33use url:: Url ;
44
5- use self :: { api:: Api , crates :: Crates } ;
5+ use self :: api:: Api ;
66use crate :: error:: Result ;
77use failure:: ResultExt ;
88
99pub ( crate ) mod api;
10+ #[ cfg( feature = "consistency_check" ) ]
1011mod crates;
1112
1213pub struct Index {
@@ -83,15 +84,16 @@ impl Index {
8384 Ok ( diff)
8485 }
8586
86- pub ( crate ) fn crates ( & self ) -> Result < Crates > {
87+ #[ cfg( feature = "consistency_check" ) ]
88+ pub ( crate ) fn crates ( & self ) -> Result < crates:: Crates > {
8789 // First ensure the index is up to date, peeking will pull the latest changes without
8890 // affecting anything else.
8991 log:: debug!( "Updating index" ) ;
9092 self . diff ( ) ?. peek_changes ( ) ?;
9193 // It'd be nice to use `crates_index` directly for interacting with the index, but it
9294 // doesn't support bare repositories. So we use its `Crate` type but walk the index
9395 // ourselves.
94- Ok ( Crates :: new ( git2:: Repository :: open ( & self . path ) ?) )
96+ Ok ( crates :: Crates :: new ( git2:: Repository :: open ( & self . path ) ?) )
9597 }
9698
9799 pub fn api ( & self ) -> & Api {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ pub(crate) use self::rustc_version::parse_rustc_version;
1414pub ( crate ) use self :: cargo_metadata:: { Dependency , Target } ;
1515
1616mod cargo_metadata;
17+ #[ cfg( feature = "consistency_check" ) ]
1718pub mod consistency;
1819mod copy;
1920mod daemon;
You can’t perform that action at this time.
0 commit comments