|
1 | 1 | //! Gets metadata about a workspace from Cargo |
2 | 2 |
|
| 3 | +use std::path::Path; |
| 4 | + |
3 | 5 | /// Describes how this module can fail |
4 | 6 | #[derive(Debug, thiserror::Error)] |
5 | 7 | pub enum Error { |
@@ -32,11 +34,7 @@ pub struct Dependency { |
32 | 34 | /// |
33 | 35 | /// Any dependency with a path beginning with `root_path` is ignored, as we |
34 | 36 | /// assume `reuse` has covered it already. |
35 | | -pub fn get( |
36 | | - cargo: &std::path::Path, |
37 | | - manifest_path: &std::path::Path, |
38 | | - root_path: &std::path::Path, |
39 | | -) -> Result<Vec<Dependency>, Error> { |
| 37 | +pub fn get(cargo: &Path, manifest_path: &Path, root_path: &Path) -> Result<Vec<Dependency>, Error> { |
40 | 38 | if manifest_path.file_name() != Some(std::ffi::OsStr::new("Cargo.toml")) { |
41 | 39 | panic!("cargo_manifest::get requires a path to a Cargo.toml file"); |
42 | 40 | } |
@@ -66,7 +64,7 @@ pub fn get( |
66 | 64 | let manifest_path = package |
67 | 65 | .get("manifest_path") |
68 | 66 | .and_then(|v| v.as_str()) |
69 | | - .map(std::path::Path::new) |
| 67 | + .map(Path::new) |
70 | 68 | .ok_or_else(|| Error::MissingJsonElement("package.manifest_path"))?; |
71 | 69 | if manifest_path.starts_with(&root_path) { |
72 | 70 | // it's an in-tree dependency and reuse covers it |
|
0 commit comments