1
1
//! Tools for gathering various kinds of metadata (Cargo.lock, Cargo metadata, Crate Index info).
2
2
3
3
mod cargo_bin;
4
+ mod cargo_toml_path;
4
5
mod cargo_tree_resolver;
5
6
mod dependency;
6
7
mod metadata_annotation;
@@ -12,12 +13,12 @@ use std::path::{Path, PathBuf};
12
13
use std:: str:: FromStr ;
13
14
14
15
use anyhow:: { bail, Context , Result } ;
15
- use camino:: Utf8Path ;
16
16
use cargo_lock:: Lockfile as CargoLockfile ;
17
17
use cargo_metadata:: Metadata as CargoMetadata ;
18
18
use tracing:: debug;
19
19
20
20
pub ( crate ) use self :: cargo_bin:: * ;
21
+ pub ( crate ) use self :: cargo_toml_path:: * ;
21
22
pub ( crate ) use self :: cargo_tree_resolver:: * ;
22
23
pub ( crate ) use self :: dependency:: * ;
23
24
pub ( crate ) use self :: metadata_annotation:: * ;
@@ -190,13 +191,13 @@ impl LockGenerator {
190
191
#[ tracing:: instrument( name = "LockGenerator::generate" , skip_all) ]
191
192
pub ( crate ) fn generate (
192
193
& self ,
193
- manifest_path : & Utf8Path ,
194
+ manifest_path : & CargoTomlPath ,
194
195
existing_lock : & Option < PathBuf > ,
195
196
update_request : & Option < CargoUpdateRequest > ,
196
197
) -> Result < cargo_lock:: Lockfile > {
197
198
debug ! ( "Generating Cargo Lockfile for {}" , manifest_path) ;
198
199
199
- let manifest_dir = manifest_path. parent ( ) . unwrap ( ) ;
200
+ let manifest_dir = manifest_path. parent ( ) ;
200
201
let generated_lockfile_path = manifest_dir. join ( "Cargo.lock" ) ;
201
202
202
203
if let Some ( lock) = existing_lock {
@@ -304,9 +305,9 @@ impl VendorGenerator {
304
305
}
305
306
}
306
307
#[ tracing:: instrument( name = "VendorGenerator::generate" , skip_all) ]
307
- pub ( crate ) fn generate ( & self , manifest_path : & Utf8Path , output_dir : & Path ) -> Result < ( ) > {
308
+ pub ( crate ) fn generate ( & self , manifest_path : & CargoTomlPath , output_dir : & Path ) -> Result < ( ) > {
308
309
debug ! ( "Vendoring {} to {}" , manifest_path, output_dir. display( ) ) ;
309
- let manifest_dir = manifest_path. parent ( ) . unwrap ( ) ;
310
+ let manifest_dir = manifest_path. parent ( ) ;
310
311
311
312
// Simply invoke `cargo generate-lockfile`
312
313
let output = self
0 commit comments