Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove disable_all_formatting #4147

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,14 +519,6 @@ fn main() {
}
```

## `disable_all_formatting`

Don't reformat anything

- **Default value**: `false`
- **Possible values**: `true`, `false`
- **Stable**: No (tracking issue: [#3388](https://github.com/rust-lang/rustfmt/issues/3388))

## `edition`

Specifies which edition is used by the parser.
Expand Down
29 changes: 0 additions & 29 deletions rustfmt-core/rustfmt-bin/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,35 +567,6 @@ mod test {
let _ = env_logger::builder().is_test(true).try_init();
}

#[test]
fn stdin_disable_all_formatting_test() {
init_log();
match option_env!("CFG_RELEASE_CHANNEL") {
None | Some("nightly") => {}
// These tests require nightly.
_ => return,
}
let input = "fn main() { println!(\"This should not be formatted.\"); }";
let mut child = Command::new(rustfmt())
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.arg("--config-path=./tests/config/disable_all_formatting.toml")
.spawn()
.expect("failed to execute child");

{
let stdin = child.stdin.as_mut().expect("failed to get stdin");
stdin
.write_all(input.as_bytes())
.expect("failed to write stdin");
}

let output = child.wait_with_output().expect("failed to wait on child");
assert!(output.status.success());
assert!(output.stderr.is_empty());
assert_eq!(input, String::from_utf8(output.stdout).unwrap());
}

#[test]
fn format_lines_errors_are_reported() {
init_log();
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions rustfmt-core/rustfmt-lib/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ create_config! {
"Require a specific version of rustfmt";
unstable_features: bool, false, false,
"Enables unstable features. Only available on nightly channel";
disable_all_formatting: bool, false, false, "Don't reformat anything";
hide_parse_errors: bool, false, false, "Hide errors from the parser";
error_on_line_overflow: bool, false, false, "Error if unable to get all lines within max_width";
error_on_unformatted: bool, false, false,
Expand Down Expand Up @@ -572,7 +571,6 @@ condense_wildcard_suffixes = false
color = "Auto"
required_version = "{}"
unstable_features = false
disable_all_formatting = false
hide_parse_errors = false
error_on_line_overflow = false
error_on_unformatted = false
Expand Down
10 changes: 0 additions & 10 deletions rustfmt-core/rustfmt-lib/src/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ impl<'b, T: Write + 'b> Session<'b, T> {
}

rustc_ast::with_globals(self.config.edition().into(), || {
if self.config.disable_all_formatting() {
// When the input is from stdin, echo back the input.
if let Input::Text(ref buf) = input {
if let Err(e) = io::stdout().write_all(buf.as_bytes()) {
return Err(From::from(e));
}
}
return Ok(FormatReport::new());
}

let config = &self.config.clone();
let format_result = format_project(input, config, self);

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.