diff options
| author | Seiichi Uchida <seuchida@gmail.com> | 2018-10-29 22:53:29 +0900 |
|---|---|---|
| committer | Seiichi Uchida <seuchida@gmail.com> | 2018-10-29 22:53:29 +0900 |
| commit | 6fa804debaec69cb49f020a84a1c62c3a8aa0969 (patch) | |
| tree | 880dc6753030c104d4c97e5c72f5352f7fc6f49f /src/bin | |
| parent | 1f64f4012fcd99c628f76455328c52c730bd2eab (diff) | |
Use edition in rustfmt.toml when no command line argument is passed
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/main.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs index 204efa19541..b3c61b3df42 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<Edition>, color: Option<Color>, 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 { |
