From 6fa804debaec69cb49f020a84a1c62c3a8aa0969 Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Mon, 29 Oct 2018 22:53:29 +0900 Subject: [PATCH] Use edition in rustfmt.toml when no command line argument is passed --- src/bin/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index 204efa19541c..b3c61b3df428 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -438,7 +438,7 @@ struct GetOptsOptions { emit_mode: EmitMode, backup: bool, check: bool, - edition: Edition, + edition: Option, color: Option, file_lines: FileLines, // Default is all lines in all files. unstable_features: bool, @@ -503,7 +503,7 @@ impl GetOptsOptions { } if let Some(ref edition_str) = matches.opt_str("edition") { - options.edition = edition_from_edition_str(edition_str)?; + options.edition = Some(edition_from_edition_str(edition_str)?); } if matches.opt_present("backup") { @@ -559,7 +559,9 @@ impl CliOptions for GetOptsOptions { if let Some(error_on_unformatted) = self.error_on_unformatted { config.set().error_on_unformatted(error_on_unformatted); } - config.set().edition(self.edition); + if let Some(edition) = self.edition { + config.set().edition(edition); + } if self.check { config.set().emit_mode(EmitMode::Diff); } else {