]> git.lizzy.rs Git - rust.git/blobdiff - tests/fmt.rs
Allow `suboptimal_flops` in const functions
[rust.git] / tests / fmt.rs
index 962425d955a79210fc98dc9db3418f151a0cc815..be42f1fbb2023b4bb5bd8d4e2937be64cafa6f80 100644 (file)
@@ -1,13 +1,16 @@
+#![cfg_attr(feature = "deny-warnings", deny(warnings))]
+#![warn(rust_2018_idioms, unused_lifetimes)]
+
 use std::path::PathBuf;
 use std::process::Command;
 
 #[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 +22,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 +34,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."
     );
 }