]> git.lizzy.rs Git - rust.git/commitdiff
Minor refactoring
authorvarkor <github@varkor.com>
Tue, 9 Jan 2018 19:55:36 +0000 (19:55 +0000)
committervarkor <github@varkor.com>
Mon, 29 Jan 2018 11:08:06 +0000 (11:08 +0000)
src/librustc_driver/driver.rs

index 4fe51138f9a51d7a6e5cbf4bf1f8ceab52e4f47b..1ab5f19c2e2a3f812823428b2938896849bde86e 100644 (file)
@@ -145,26 +145,23 @@ macro_rules! controller_entry_point {
         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);