Skip to content

Commit c10c732

Browse files
committed
Simplify CompilerCalls impl
1 parent 8e8a5b3 commit c10c732

File tree

1 file changed

+1
-33
lines changed

1 file changed

+1
-33
lines changed

src/lib.rs

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -285,33 +285,11 @@ fn fmt_lines(changes: &mut ChangeSet, config: &Config) -> FormatReport {
285285
}
286286

287287
struct RustFmtCalls {
288-
input_path: Option<PathBuf>,
289288
write_mode: WriteMode,
290289
config: Option<Box<config::Config>>,
291290
}
292291

293292
impl<'a> CompilerCalls<'a> for RustFmtCalls {
294-
fn early_callback(&mut self,
295-
_: &getopts::Matches,
296-
_: &diagnostics::registry::Registry)
297-
-> Compilation {
298-
Compilation::Continue
299-
}
300-
301-
fn some_input(&mut self,
302-
input: Input,
303-
input_path: Option<PathBuf>)
304-
-> (Input, Option<PathBuf>) {
305-
match input_path {
306-
Some(ref ip) => self.input_path = Some(ip.clone()),
307-
_ => {
308-
// FIXME should handle string input and write to stdout or something
309-
panic!("No input path");
310-
}
311-
}
312-
(input, input_path)
313-
}
314-
315293
fn no_input(&mut self,
316294
_: &getopts::Matches,
317295
_: &rustc_config::Options,
@@ -322,16 +300,6 @@ impl<'a> CompilerCalls<'a> for RustFmtCalls {
322300
panic!("No input supplied to RustFmt");
323301
}
324302

325-
fn late_callback(&mut self,
326-
_: &getopts::Matches,
327-
_: &Session,
328-
_: &Input,
329-
_: &Option<PathBuf>,
330-
_: &Option<PathBuf>)
331-
-> Compilation {
332-
Compilation::Continue
333-
}
334-
335303
fn build_controller(&mut self, _: &Session) -> driver::CompileController<'a> {
336304
let write_mode = self.write_mode;
337305

@@ -373,6 +341,6 @@ impl<'a> CompilerCalls<'a> for RustFmtCalls {
373341
// default_config is a string of toml data to be used to configure rustfmt.
374342
pub fn run(args: Vec<String>, write_mode: WriteMode, default_config: &str) {
375343
let config = Some(Box::new(config::Config::from_toml(default_config)));
376-
let mut call_ctxt = RustFmtCalls { input_path: None, write_mode: write_mode, config: config };
344+
let mut call_ctxt = RustFmtCalls { write_mode: write_mode, config: config };
377345
rustc_driver::run_compiler(&args, &mut call_ctxt);
378346
}

0 commit comments

Comments
 (0)