Skip to content

Commit b55e50f

Browse files
committed
rustfmt: Move getopts::Options creation to its own function
1 parent 19849fe commit b55e50f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/bin/rustfmt.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn update_config(config: &mut Config, matches: &Matches) -> Result<(), String> {
134134
}
135135
}
136136

137-
fn execute() -> i32 {
137+
fn make_opts() -> Options {
138138
let mut opts = Options::new();
139139
opts.optflag("h", "help", "show this message");
140140
opts.optflag("V", "version", "show version information");
@@ -154,6 +154,12 @@ fn execute() -> i32 {
154154
found reverts to the input file path",
155155
"[Path for the configuration file]");
156156

157+
opts
158+
}
159+
160+
fn execute() -> i32 {
161+
let opts = make_opts();
162+
157163
let matches = match opts.parse(env::args().skip(1)) {
158164
Ok(m) => m,
159165
Err(e) => {

0 commit comments

Comments
 (0)