From ddc8cc92c998b7d80c782d00d178c791ab564915 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Mon, 11 Aug 2014 21:12:23 +1000 Subject: [PATCH] rustc: remove a trait that is unnecessary after pretty move. The type in the `impl` is now in the module with the trait. --- src/librustc/driver/pretty.rs | 52 ++++++++++++++--------------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/src/librustc/driver/pretty.rs b/src/librustc/driver/pretty.rs index 8f2b56f9ce3..d7118c7e54c 100644 --- a/src/librustc/driver/pretty.rs +++ b/src/librustc/driver/pretty.rs @@ -87,15 +87,33 @@ pub fn parse_pretty(sess: &Session, name: &str) -> (PpMode, Option(&self, sess: Session, krate: &ast::Crate, ast_map: Option, id: String, - use_once_payload: B, - f: |&PrinterSupport, B| -> A) -> A; + payload: B, + f: |&PrinterSupport, B| -> A) -> A { + match *self { + PpmNormal | PpmExpanded => { + let annotation = NoAnn { sess: sess, ast_map: ast_map }; + f(&annotation, payload) + } + + PpmIdentified | PpmExpandedIdentified => { + let annotation = IdentifiedAnnotation { sess: sess, ast_map: ast_map }; + f(&annotation, payload) + } + PpmTyped => { + let ast_map = ast_map.expect("--pretty=typed missing ast_map"); + let analysis = driver::phase_3_run_analysis_passes(sess, krate, ast_map, id); + let annotation = TypedAnnotation { analysis: analysis }; + f(&annotation, payload) + } + } + } } trait SessionCarrier { @@ -339,34 +357,6 @@ impl UserIdentifiedItem { } } -impl CratePrinter for PpSourceMode { - fn call_with_pp_support(&self, - sess: Session, - krate: &ast::Crate, - ast_map: Option, - id: String, - payload: B, - f: |&PrinterSupport, B| -> A) -> A { - match *self { - PpmNormal | PpmExpanded => { - let annotation = NoAnn { sess: sess, ast_map: ast_map }; - f(&annotation, payload) - } - - PpmIdentified | PpmExpandedIdentified => { - let annotation = IdentifiedAnnotation { sess: sess, ast_map: ast_map }; - f(&annotation, payload) - } - PpmTyped => { - let ast_map = ast_map.expect("--pretty=typed missing ast_map"); - let analysis = driver::phase_3_run_analysis_passes(sess, krate, ast_map, id); - let annotation = TypedAnnotation { analysis: analysis }; - f(&annotation, payload) - } - } - } -} - fn needs_ast_map(ppm: &PpMode, opt_uii: &Option) -> bool { match *ppm { PpmSource(PpmNormal) |