diff --git a/.cargo/Makefile.toml b/.cargo/Makefile.toml index 85de1f4d494..9d79bddad79 100644 --- a/.cargo/Makefile.toml +++ b/.cargo/Makefile.toml @@ -4,9 +4,22 @@ CFG_RELEASE = { value = "${CARGO_MAKE_RUST_VERSION}", condition = { env_not_set = ["CFG_RELEASE"] } } CFG_RELEASE_CHANNEL = { value = "${CARGO_MAKE_RUST_CHANNEL}", condition = { env_not_set = ["CFG_RELEASE_CHANNEL"] } } +[tasks.build-bin] +workspace = false +command = "cargo" +args = [ + "build", + "--bin", + "rustfmt", + "--all-features", +] + [tasks.b] alias = "build" +[tasks.bb] +alias = "build-bin" + [tasks.c] alias = "check" diff --git a/Makefile.toml b/Makefile.toml index e26685aba54..57c5f3f4969 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -1,15 +1,5 @@ extend = ".cargo/Makefile.toml" -[tasks.build] -clear = true -command = "cargo" -args = [ - "build", - "--manifest-path", - "rustfmt-core/Cargo.toml", - "--workspace", -] - [tasks.install] command = "cargo" args = [ diff --git a/rustfmt-core/rustfmt-lib/config_proc_macro/Cargo.toml b/rustfmt-core/rustfmt-lib/config_proc_macro/Cargo.toml index eb045a452ad..c8d5497f911 100644 --- a/rustfmt-core/rustfmt-lib/config_proc_macro/Cargo.toml +++ b/rustfmt-core/rustfmt-lib/config_proc_macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustfmt-config_proc_macro" -version = "0.5.0" +version = "0.5.1" authors = ["topecongiro "] edition = "2018" description = "A collection of procedural macros for rustfmt" @@ -21,4 +21,3 @@ serde = { version = "1.0", features = ["derive"] } [features] default = [] -debug-with-rustfmt = [] diff --git a/rustfmt-core/rustfmt-lib/config_proc_macro/src/lib.rs b/rustfmt-core/rustfmt-lib/config_proc_macro/src/lib.rs index 66cfd3c727d..caece7e8595 100644 --- a/rustfmt-core/rustfmt-lib/config_proc_macro/src/lib.rs +++ b/rustfmt-core/rustfmt-lib/config_proc_macro/src/lib.rs @@ -18,8 +18,7 @@ pub fn config_type(_args: TokenStream, input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as syn::Item); let output = config_type::define_config_type(&input); - #[cfg(feature = "debug-with-rustfmt")] - { + if std::env::var("RUSTFMT_DEV_DEBUG_PROC_MACRO").is_ok() { utils::debug_with_rustfmt(&output); } diff --git a/rustfmt-core/rustfmt-lib/config_proc_macro/src/utils.rs b/rustfmt-core/rustfmt-lib/config_proc_macro/src/utils.rs index fec6a8e4907..739a2e29efd 100644 --- a/rustfmt-core/rustfmt-lib/config_proc_macro/src/utils.rs +++ b/rustfmt-core/rustfmt-lib/config_proc_macro/src/utils.rs @@ -19,9 +19,8 @@ pub fn is_unit(v: &syn::Variant) -> bool { } } -#[cfg(feature = "debug-with-rustfmt")] /// Pretty-print the output of proc macro using rustfmt. -pub fn debug_with_rustfmt(input: &TokenStream) { +pub(crate) fn debug_with_rustfmt(input: &TokenStream) { use std::io::Write; use std::process::{Command, Stdio};