diff --git a/.travis.yml b/.travis.yml index 966b7d7bac4..70132e46ffd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,9 +47,7 @@ matrix: script: - | if [ -z ${INTEGRATION} ]; then - cargo build - cargo test - cargo test -- --ignored + cargo build && cargo test && cargo test -- --ignored else ./ci/integration.sh fi diff --git a/Cargo.lock b/Cargo.lock index 5ed591d42be..40979a53bd6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,6 +24,14 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "arrayref" version = "0.3.5" @@ -794,6 +802,7 @@ name = "rustfmt-nightly" version = "1.4.10" dependencies = [ "annotate-snippets 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytecount 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "cargo_metadata 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "derive-new 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1085,6 +1094,7 @@ dependencies = [ "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum annotate-snippets 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7021ce4924a3f25f802b2cccd1af585e39ea1a363a1aa2e72afe54b67a3a7a7" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" diff --git a/Cargo.toml b/Cargo.toml index 89cd280062b..351486b0a78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,6 +57,7 @@ annotate-snippets = { version = "0.6", features = ["ansi_term"] } structopt = "0.3" rustfmt-config_proc_macro = { version = "0.2", path = "config_proc_macro" } lazy_static = "1.0.0" +ansi_term = "0.12" # A noop dependency that changes in the Rust repository, it's a bit of a hack. # See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust` diff --git a/Configurations.md b/Configurations.md index e1885aba836..0064f561720 100644 --- a/Configurations.md +++ b/Configurations.md @@ -1881,7 +1881,7 @@ specific version of rustfmt is used in your CI, use this option. - **Possible values**: any published version (e.g. `"0.3.8"`) - **Stable**: No (tracking issue: #3386) -## `skip_children` +## `skip_children` (DEPRECATED #3587) Don't reformat out of line modules diff --git a/src/bin/main.rs b/src/bin/main.rs index 661502a2e0e..ccbfb4052e2 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -11,6 +11,8 @@ use std::io::{self, stdout, Read, Write}; use std::path::{Path, PathBuf}; use std::str::FromStr; +use ansi_term::Colour::Red; + use getopts::{Matches, Options}; use crate::rustfmt::{ @@ -513,6 +515,12 @@ struct GetOptsOptions { print_misformatted_file_names: bool, } +fn deprecate_skip_children() { + let msg = "Option --skip-children is deprecated since it is now the default to not format \ + submodules of given files (#3587)"; + eprintln!("{}: {}", Red.bold().paint("Deprecation"), msg); +} + impl GetOptsOptions { pub fn from_matches(matches: &Matches) -> Result { let mut options = GetOptsOptions::default(); @@ -529,6 +537,7 @@ impl GetOptsOptions { if options.unstable_features { if matches.opt_present("skip-children") { + deprecate_skip_children(); options.skip_children = Some(true); } if matches.opt_present("error-on-unformatted") { @@ -540,6 +549,7 @@ impl GetOptsOptions { } else { let mut unstable_options = vec![]; if matches.opt_present("skip-children") { + deprecate_skip_children(); unstable_options.push("`--skip-children`"); } if matches.opt_present("error-on-unformatted") { diff --git a/src/config/config_type.rs b/src/config/config_type.rs index 2eff7561392..b8f0691a7b9 100644 --- a/src/config/config_type.rs +++ b/src/config/config_type.rs @@ -58,6 +58,9 @@ macro_rules! create_config { use serde::{Deserialize, Serialize}; + // for error messages + use ansi_term::Colour::Red; + #[derive(Clone)] #[allow(unreachable_pub)] pub struct Config { @@ -137,8 +140,17 @@ macro_rules! create_config { } fn fill_from_parsed_config(mut self, parsed: PartialConfig, dir: &Path) -> Config { + let deprecate_skip_children = || { + let msg = "Option skip_children is deprecated since it is now the default to \ + not format submodules of given files (#3587)"; + eprintln!("{}: {}", Red.bold().paint("Deprecation"), msg); + }; + $( if let Some(val) = parsed.$i { + if stringify!($i) == "skip_children" { + deprecate_skip_children() + } if self.$i.3 { self.$i.1 = true; self.$i.2 = val;