From 5c0b99820b6f7d4e35cc8c8a73f60f7de4001e73 Mon Sep 17 00:00:00 2001 From: Shotaro Yamada Date: Thu, 9 Nov 2017 11:05:49 +0900 Subject: [PATCH 1/2] Use compiletest 0.3 --- Cargo.toml | 2 +- tests/compile-test.rs | 4 +++- tests/ui/cstring.stderr | 8 -------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 047d966be66..2fbf6d17ce4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ clippy_lints = { version = "0.0.169", path = "clippy_lints" } cargo_metadata = "0.2" [dev-dependencies] -compiletest_rs = "0.2.7" +compiletest_rs = "0.3" duct = "0.8.2" lazy_static = "0.2" regex = "0.2" diff --git a/tests/compile-test.rs b/tests/compile-test.rs index be8793215dc..cda3a586546 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -22,7 +22,9 @@ fn run_mode(dir: &'static str, mode: &'static str) { } config.mode = cfg_mode; - config.build_base = PathBuf::from("target/debug/test_build_base"); + config.build_base = PathBuf::from("target/debug/test_build_base") + .canonicalize() + .unwrap(); config.src_base = PathBuf::from(format!("tests/{}", dir)); config.rustc_path = clippy_driver_path(); diff --git a/tests/ui/cstring.stderr b/tests/ui/cstring.stderr index ddb74ce9cac..c3dd9cf83f6 100644 --- a/tests/ui/cstring.stderr +++ b/tests/ui/cstring.stderr @@ -1,11 +1,3 @@ -error: function is never used: `temporary_cstring` - --> $DIR/cstring.rs:4:1 - | -4 | fn temporary_cstring() { - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D dead-code` implied by `-D warnings` - error: you are getting the inner pointer of a temporary `CString` --> $DIR/cstring.rs:7:5 | From b17899878f3efe6802bc6604b922822c7d9ab309 Mon Sep 17 00:00:00 2001 From: Shotaro Yamada Date: Thu, 9 Nov 2017 14:47:14 +0900 Subject: [PATCH 2/2] Build path from current_dir --- tests/compile-test.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/compile-test.rs b/tests/compile-test.rs index cda3a586546..bd968cc6009 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -22,9 +22,11 @@ fn run_mode(dir: &'static str, mode: &'static str) { } config.mode = cfg_mode; - config.build_base = PathBuf::from("target/debug/test_build_base") - .canonicalize() - .unwrap(); + config.build_base = { + let mut path = std::env::current_dir().unwrap(); + path.push("target/debug/test_build_base"); + path + }; config.src_base = PathBuf::from(format!("tests/{}", dir)); config.rustc_path = clippy_driver_path();