Skip to content

Commit d97da7d

Browse files
committed
Minor refactoring
1 parent ba76092 commit d97da7d

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

src/librustc_driver/driver.rs

+16-19
Original file line numberDiff line numberDiff line change
@@ -145,26 +145,23 @@ pub fn compile_input(trans: Box<TransCrate>,
145145
let output_paths = generated_output_paths(sess, &outputs, &crate_name);
146146

147147
// Ensure the source file isn't accidentally overwritten during compilation.
148-
match *input_path {
149-
Some(ref input_path) => {
150-
if sess.opts.will_create_output_file() {
151-
if output_contains_path(&output_paths, input_path) {
152-
sess.err(&format!(
153-
"the input file \"{}\" would be overwritten by the generated \
154-
executable",
155-
input_path.display()));
156-
return Err(CompileIncomplete::Stopped);
157-
}
158-
if let Some(dir_path) = output_conflicts_with_dir(&output_paths) {
159-
sess.err(&format!(
160-
"the generated executable for the input file \"{}\" conflicts with the \
161-
existing directory \"{}\"",
162-
input_path.display(), dir_path.display()));
163-
return Err(CompileIncomplete::Stopped);
164-
}
148+
if let Some(ref input_path) = *input_path {
149+
if sess.opts.will_create_output_file() {
150+
if output_contains_path(&output_paths, input_path) {
151+
sess.err(&format!(
152+
"the input file \"{}\" would be overwritten by the generated \
153+
executable",
154+
input_path.display()));
155+
return Err(CompileIncomplete::Stopped);
165156
}
166-
},
167-
None => {}
157+
if let Some(dir_path) = output_conflicts_with_dir(&output_paths) {
158+
sess.err(&format!(
159+
"the generated executable for the input file \"{}\" conflicts with the \
160+
existing directory \"{}\"",
161+
input_path.display(), dir_path.display()));
162+
return Err(CompileIncomplete::Stopped);
163+
}
164+
}
168165
}
169166

170167
write_out_deps(sess, &outputs, &output_paths);

0 commit comments

Comments
 (0)