diff options
| author | varkor <github@varkor.com> | 2018-01-09 19:55:36 +0000 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-01-29 11:08:06 +0000 |
| commit | d97da7d536b85bda9ff9255b1cd27f1285143930 (patch) | |
| tree | ce7f7e4335989ba2d095822d2a9f3726a97118bd | |
| parent | ba76092c2ef771f4b4463ec5e879f12194e59ec5 (diff) | |
Minor refactoring
| -rw-r--r-- | src/librustc_driver/driver.rs | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 4fe51138f9a..1ab5f19c2e2 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -145,26 +145,23 @@ pub fn compile_input(trans: Box<TransCrate>, let output_paths = generated_output_paths(sess, &outputs, &crate_name); // Ensure the source file isn't accidentally overwritten during compilation. - match *input_path { - Some(ref input_path) => { - if sess.opts.will_create_output_file() { - if output_contains_path(&output_paths, input_path) { - sess.err(&format!( - "the input file \"{}\" would be overwritten by the generated \ - executable", - input_path.display())); - return Err(CompileIncomplete::Stopped); - } - if let Some(dir_path) = output_conflicts_with_dir(&output_paths) { - sess.err(&format!( - "the generated executable for the input file \"{}\" conflicts with the \ - existing directory \"{}\"", - input_path.display(), dir_path.display())); - return Err(CompileIncomplete::Stopped); - } + if let Some(ref input_path) = *input_path { + if sess.opts.will_create_output_file() { + if output_contains_path(&output_paths, input_path) { + sess.err(&format!( + "the input file \"{}\" would be overwritten by the generated \ + executable", + input_path.display())); + return Err(CompileIncomplete::Stopped); } - }, - None => {} + if let Some(dir_path) = output_conflicts_with_dir(&output_paths) { + sess.err(&format!( + "the generated executable for the input file \"{}\" conflicts with the \ + existing directory \"{}\"", + input_path.display(), dir_path.display())); + return Err(CompileIncomplete::Stopped); + } + } } write_out_deps(sess, &outputs, &output_paths); |
