]> git.lizzy.rs Git - rust.git/blobdiff - tests/fmt.rs
add tests for a false negative on `needless_return`
[rust.git] / tests / fmt.rs
index 962425d955a79210fc98dc9db3418f151a0cc815..7616d8001e8853bb8e9de4e44659d01b3253bd6f 100644 (file)
@@ -3,11 +3,11 @@
 
 #[test]
 fn fmt() {
-    if option_env!("RUSTC_TEST_SUITE").is_some() {
+    if option_env!("RUSTC_TEST_SUITE").is_some() || option_env!("NO_FMT_TEST").is_some() {
         return;
     }
 
-    // Skip this test if rustup nightly is unavailable
+    // Skip this test if nightly rustfmt is unavailable
     let rustup_output = Command::new("rustup")
         .args(&["component", "list", "--toolchain", "nightly"])
         .output()
@@ -19,12 +19,9 @@ fn fmt() {
     }
 
     let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
-    let dev_dir = root_dir.join("clippy_dev");
-    let target_dir = root_dir.join("target");
-    let target_dir = target_dir.to_str().unwrap();
     let output = Command::new("cargo")
-        .current_dir(dev_dir)
-        .args(&["+nightly", "run", "--target-dir", target_dir, "--", "fmt", "--check"])
+        .current_dir(root_dir)
+        .args(&["dev", "fmt", "--check"])
         .output()
         .unwrap();
 
@@ -34,6 +31,6 @@ fn fmt() {
 
     assert!(
         output.status.success(),
-        "Formatting check failed. Run `./util/dev fmt` to update formatting."
+        "Formatting check failed. Run `cargo dev fmt` to update formatting."
     );
 }