Merge pull request #1909 from Arnavion/fix-manifest-path

Canonicalize --manifest-path argument before comparing it to cargo metadata.
This commit is contained in:
Oliver Schneider 2017-07-31 22:42:17 +02:00 committed by GitHub
commit f1fa1768a2
2 changed files with 7 additions and 3 deletions

View File

@ -38,6 +38,8 @@ script:
- cd clippy_workspace_tests/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../..
- cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../..
- cd clippy_workspace_tests/subcrate/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../../..
- PATH=$PATH:~/rust/cargo/bin cargo clippy --manifest-path=clippy_workspace_tests/Cargo.toml -- -D clippy
- cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy --manifest-path=../Cargo.toml -- -D clippy && cd ../..
- set +e
after_success: |

View File

@ -191,12 +191,14 @@ pub fn main() {
process::exit(101);
};
let manifest_path = manifest_path_arg.map(|arg| PathBuf::from(Path::new(&arg["--manifest-path=".len()..])));
let manifest_path = manifest_path_arg.map(|arg| Path::new(&arg["--manifest-path=".len()..])
.canonicalize().expect("manifest path could not be canonicalized"));
let package_index = {
if let Some(ref manifest_path) = manifest_path {
if let Some(manifest_path) = manifest_path {
metadata.packages.iter().position(|package| {
let package_manifest_path = Path::new(&package.manifest_path);
let package_manifest_path = Path::new(&package.manifest_path)
.canonicalize().expect("package manifest path could not be canonicalized");
package_manifest_path == manifest_path
})
} else {