Skip to content

Commit cc56957

Browse files
authored
Update rustfmt command line interface (#4006)
1 parent 8b14eea commit cc56957

File tree

30 files changed

+461
-801
lines changed

30 files changed

+461
-801
lines changed

Diff for: Cargo.lock

+5-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+8-9
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,24 @@ test = false
3333

3434
[features]
3535
default = ["cargo-fmt", "rustfmt-format-diff"]
36-
cargo-fmt = []
37-
rustfmt-format-diff = []
36+
cargo-fmt = ["cargo_metadata"]
37+
rustfmt-format-diff = ["regex", "serde", "serde_json"]
3838
generic-simd = ["rustfmt_lib/generic-simd"]
3939

4040
[dependencies]
41-
ansi_term = "0.12"
4241
anyhow = "1.0"
43-
cargo_metadata = "0.9"
4442
env_logger = "0.7"
45-
getopts = "0.2"
4643
log = "0.4"
47-
regex = "1.0"
48-
serde = "1.0"
49-
serde_json = "1.0"
5044
structopt = "0.3"
5145
term = "0.6"
5246
thiserror = "1.0"
5347

54-
rustfmt_lib = { path = "rustfmt-core/rustfmt-lib", version = "1.0" }
48+
cargo_metadata = { version = "0.9", optional = true }
49+
regex = { version = "1.0", optional = true }
50+
serde = { version = "1.0", optional = true }
51+
serde_json = { version = "1.0", optional = true }
52+
53+
rustfmt_lib = { path = "rustfmt-core/rustfmt-lib", version = "2.0.0-rc.1" }
5554

5655
[dev-dependencies]
5756
lazy_static = "1.0"

Diff for: Configurations.md

-8
Original file line numberDiff line numberDiff line change
@@ -1881,14 +1881,6 @@ specific version of rustfmt is used in your CI, use this option.
18811881
- **Possible values**: any published version (e.g. `"0.3.8"`)
18821882
- **Stable**: No (tracking issue: #3386)
18831883

1884-
## `skip_children` (DEPRECATED #3587)
1885-
1886-
Don't reformat out of line modules
1887-
1888-
- **Default value**: `false`
1889-
- **Possible values**: `true`, `false`
1890-
- **Stable**: No (tracking issue: #3389)
1891-
18921884
## `space_after_colon`
18931885

18941886
Leave a space after the colon.

Diff for: rustfmt-core/rustfmt-bin/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ structopt = "0.3"
4141
term = "0.6"
4242
thiserror = "1.0"
4343

44-
rustfmt_lib = { path = "../rustfmt-lib", version = "1.0" }
44+
rustfmt_lib = { path = "../rustfmt-lib", version = "2.0.0-rc.1" }
4545

4646
[dev-dependencies]
4747
lazy_static = "1.0"

Diff for: rustfmt-core/rustfmt-bin/build.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ fn main() {
1212
}
1313

1414
println!("cargo:rerun-if-env-changed=CFG_RELEASE_CHANNEL");
15+
if option_env!("CFG_RELEASE_CHANNEL").map_or(true, |c| c == "nightly" || c == "dev") {
16+
println!("cargo:rustc-cfg=nightly");
17+
}
1518

1619
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
1720

18-
File::create(out_dir.join("commit-info.txt"))
21+
File::create(out_dir.join("version-info.txt"))
1922
.unwrap()
2023
.write_all(commit_info().as_bytes())
2124
.unwrap();
@@ -25,7 +28,10 @@ fn main() {
2528
// (git not installed or if this is not a git repository) just return an empty string.
2629
fn commit_info() -> String {
2730
match (channel(), commit_hash(), commit_date()) {
28-
(channel, Some(hash), Some(date)) => format!("{} ({} {})", channel, hash.trim_end(), date),
31+
(channel, Some(hash), Some(date)) => {
32+
format!("{}-{} ({} {})", option_env!("CARGO_PKG_VERSION")
33+
.unwrap_or("unknown"), channel, hash.trim_end(), date)
34+
},
2935
_ => String::new(),
3036
}
3137
}

0 commit comments

Comments
 (0)