From 66483017f66b37b2c585cdfae4df59e89df41e42 Mon Sep 17 00:00:00 2001 From: Kamal Marhubi Date: Mon, 30 May 2016 16:41:43 +0200 Subject: [PATCH] Explain that FileLines cannot be given in rustfmt.toml This adds a note to both the `--config-help` output for `file_lines`, and to the panic message on attempting to deserialize a `FileLines` struct. --- src/config.rs | 3 ++- src/file_lines.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index ecb63851417..51daa7a505a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -335,7 +335,8 @@ create_config! { verbose: bool, false, "Use verbose output"; skip_children: bool, false, "Don't reformat out of line modules"; file_lines: FileLines, FileLines::all(), - "Lines to format"; + "Lines to format; this is not supported in rustfmt.toml, and can only be specified \ + via the --file-lines option"; max_width: usize, 100, "Maximum width of each line"; ideal_width: usize, 80, "Ideal width of each line"; tab_spaces: usize, 4, "Number of spaces per tab"; diff --git a/src/file_lines.rs b/src/file_lines.rs index 9c60821a3bb..28fedad4cfd 100644 --- a/src/file_lines.rs +++ b/src/file_lines.rs @@ -181,7 +181,8 @@ impl JsonSpan { // for `FileLines`, so it will just panic instead. impl rustc_serialize::Decodable for FileLines { fn decode(_: &mut D) -> Result { - unimplemented!(); + panic!("FileLines cannot be deserialized from a project rustfmt.toml file: please \ + specify it via the `--file-lines` option instead"); } }