From b55e50f3875f5b531f8180dcab3a260ad1f351a1 Mon Sep 17 00:00:00 2001 From: Kamal Marhubi Date: Sun, 10 Apr 2016 17:57:44 -0400 Subject: [PATCH] rustfmt: Move getopts::Options creation to its own function --- src/bin/rustfmt.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bin/rustfmt.rs b/src/bin/rustfmt.rs index b65cbaa7f59..dba91612761 100644 --- a/src/bin/rustfmt.rs +++ b/src/bin/rustfmt.rs @@ -134,7 +134,7 @@ fn update_config(config: &mut Config, matches: &Matches) -> Result<(), String> { } } -fn execute() -> i32 { +fn make_opts() -> Options { let mut opts = Options::new(); opts.optflag("h", "help", "show this message"); opts.optflag("V", "version", "show version information"); @@ -154,6 +154,12 @@ fn execute() -> i32 { found reverts to the input file path", "[Path for the configuration file]"); + opts +} + +fn execute() -> i32 { + let opts = make_opts(); + let matches = match opts.parse(env::args().skip(1)) { Ok(m) => m, Err(e) => { -- 2.44.0