Skip to content

Commit 2da4f63

Browse files
authored
Remove disable_all_formatting (#4147)
1 parent bfc439d commit 2da4f63

File tree

9 files changed

+0
-78
lines changed

9 files changed

+0
-78
lines changed

Configurations.md

-8
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,6 @@ fn main() {
523523
}
524524
```
525525

526-
## `disable_all_formatting`
527-
528-
Don't reformat anything
529-
530-
- **Default value**: `false`
531-
- **Possible values**: `true`, `false`
532-
- **Stable**: No (tracking issue: [#3388](https://github.com/rust-lang/rustfmt/issues/3388))
533-
534526
## `edition`
535527

536528
Specifies which edition is used by the parser.

rustfmt-core/rustfmt-bin/src/bin/main.rs

-29
Original file line numberDiff line numberDiff line change
@@ -567,35 +567,6 @@ mod test {
567567
let _ = env_logger::builder().is_test(true).try_init();
568568
}
569569

570-
#[test]
571-
fn stdin_disable_all_formatting_test() {
572-
init_log();
573-
match option_env!("CFG_RELEASE_CHANNEL") {
574-
None | Some("nightly") => {}
575-
// These tests require nightly.
576-
_ => return,
577-
}
578-
let input = "fn main() { println!(\"This should not be formatted.\"); }";
579-
let mut child = Command::new(rustfmt())
580-
.stdin(Stdio::piped())
581-
.stdout(Stdio::piped())
582-
.arg("--config-path=./tests/config/disable_all_formatting.toml")
583-
.spawn()
584-
.expect("failed to execute child");
585-
586-
{
587-
let stdin = child.stdin.as_mut().expect("failed to get stdin");
588-
stdin
589-
.write_all(input.as_bytes())
590-
.expect("failed to write stdin");
591-
}
592-
593-
let output = child.wait_with_output().expect("failed to wait on child");
594-
assert!(output.status.success());
595-
assert!(output.stderr.is_empty());
596-
assert_eq!(input, String::from_utf8(output.stdout).unwrap());
597-
}
598-
599570
#[test]
600571
fn format_lines_errors_are_reported() {
601572
init_log();

rustfmt-core/rustfmt-bin/tests/config/disable_all_formatting.toml

-1
This file was deleted.

rustfmt-core/rustfmt-lib/src/config.rs

-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ create_config! {
144144
"Require a specific version of rustfmt";
145145
unstable_features: bool, false, false,
146146
"Enables unstable features. Only available on nightly channel";
147-
disable_all_formatting: bool, false, false, "Don't reformat anything";
148147
hide_parse_errors: bool, false, false, "Hide errors from the parser";
149148
error_on_line_overflow: bool, false, false, "Error if unable to get all lines within max_width";
150149
error_on_unformatted: bool, false, false,
@@ -572,7 +571,6 @@ condense_wildcard_suffixes = false
572571
color = "Auto"
573572
required_version = "{}"
574573
unstable_features = false
575-
disable_all_formatting = false
576574
hide_parse_errors = false
577575
error_on_line_overflow = false
578576
error_on_unformatted = false

rustfmt-core/rustfmt-lib/src/formatting.rs

-10
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ impl<'b, T: Write + 'b> Session<'b, T> {
2929
}
3030

3131
rustc_ast::with_globals(self.config.edition().into(), || {
32-
if self.config.disable_all_formatting() {
33-
// When the input is from stdin, echo back the input.
34-
if let Input::Text(ref buf) = input {
35-
if let Err(e) = io::stdout().write_all(buf.as_bytes()) {
36-
return Err(From::from(e));
37-
}
38-
}
39-
return Ok(FormatReport::new());
40-
}
41-
4232
let config = &self.config.clone();
4333
let format_result = format_project(input, config, self);
4434

rustfmt-core/rustfmt-lib/tests/source/configs/disable_all_formatting/false.rs

-6
This file was deleted.

rustfmt-core/rustfmt-lib/tests/source/configs/disable_all_formatting/true.rs

-6
This file was deleted.

rustfmt-core/rustfmt-lib/tests/target/configs/disable_all_formatting/false.rs

-10
This file was deleted.

rustfmt-core/rustfmt-lib/tests/target/configs/disable_all_formatting/true.rs

-6
This file was deleted.

0 commit comments

Comments
 (0)