diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index 1e0e2018050ba..5c2cac2daeb07 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -30,7 +30,9 @@ #![feature(unique)] #![cfg_attr(test, feature(rustc_private, rand, collections))] -#[cfg(test)] #[macro_use] extern crate log; +#[cfg(test)] +#[macro_use] +extern crate log; extern crate libc; @@ -123,7 +125,7 @@ pub fn deflate_bytes_zlib(bytes: &[u8]) -> Bytes { deflate_bytes_internal(bytes, LZ_NORM | TDEFL_WRITE_ZLIB_HEADER) } -fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Result { +fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Result { unsafe { let mut outsz: size_t = 0; let res = tinfl_decompress_mem_to_heap(bytes.as_ptr() as *const _, @@ -142,12 +144,12 @@ fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Result { } /// Decompress a buffer, without parsing any sort of header on the input. -pub fn inflate_bytes(bytes: &[u8]) -> Result { +pub fn inflate_bytes(bytes: &[u8]) -> Result { inflate_bytes_internal(bytes, 0) } /// Decompress a buffer that starts with a zlib header. -pub fn inflate_bytes_zlib(bytes: &[u8]) -> Result { +pub fn inflate_bytes_zlib(bytes: &[u8]) -> Result { inflate_bytes_internal(bytes, TINFL_FLAG_PARSE_ZLIB_HEADER) } diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 95b78e1cbfd03..7c8c1ead285ab 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -432,15 +432,17 @@ pub trait Labeller<'a,N,E> { } impl<'a> LabelText<'a> { - pub fn label>(s: S) -> LabelText<'a> { + pub fn label>(s: S) -> LabelText<'a> { LabelStr(s.into_cow()) } - pub fn escaped>(s: S) -> LabelText<'a> { + pub fn escaped>(s: S) -> LabelText<'a> { EscStr(s.into_cow()) } - fn escape_char(c: char, mut f: F) where F: FnMut(char) { + fn escape_char(c: char, mut f: F) + where F: FnMut(char) + { match c { // not escaping \\, since Graphviz escString needs to // interpret backslashes; see EscStr above. @@ -531,29 +533,40 @@ pub enum RenderOption { } /// Returns vec holding all the default render options. -pub fn default_options() -> Vec { vec![] } +pub fn default_options() -> Vec { + vec![] +} /// Renders directed graph `g` into the writer `w` in DOT syntax. /// (Simple wrapper around `render_opts` that passes a default set of options.) -pub fn render<'a, N:Clone+'a, E:Clone+'a, G:Labeller<'a,N,E>+GraphWalk<'a,N,E>, W:Write>( - g: &'a G, - w: &mut W) -> io::Result<()> { +pub fn render<'a, + N: Clone + 'a, + E: Clone + 'a, + G: Labeller<'a, N, E> + GraphWalk<'a, N, E>, + W: Write> + (g: &'a G, + w: &mut W) + -> io::Result<()> { render_opts(g, w, &[]) } /// Renders directed graph `g` into the writer `w` in DOT syntax. /// (Main entry point for the library.) -pub fn render_opts<'a, N:Clone+'a, E:Clone+'a, G:Labeller<'a,N,E>+GraphWalk<'a,N,E>, W:Write>( - g: &'a G, - w: &mut W, - options: &[RenderOption]) -> io::Result<()> -{ - fn writeln(w: &mut W, arg: &[&str]) -> io::Result<()> { +pub fn render_opts<'a, + N: Clone + 'a, + E: Clone + 'a, + G: Labeller<'a, N, E> + GraphWalk<'a, N, E>, + W: Write> + (g: &'a G, + w: &mut W, + options: &[RenderOption]) + -> io::Result<()> { + fn writeln(w: &mut W, arg: &[&str]) -> io::Result<()> { for &s in arg { try!(w.write_all(s.as_bytes())); } write!(w, "\n") } - fn indent(w: &mut W) -> io::Result<()> { + fn indent(w: &mut W) -> io::Result<()> { w.write_all(b" ") } @@ -657,9 +670,7 @@ mod tests { } impl LabelledGraph { - fn new(name: &'static str, - node_labels: Trivial, - edges: Vec) -> LabelledGraph { + fn new(name: &'static str, node_labels: Trivial, edges: Vec) -> LabelledGraph { LabelledGraph { name: name, node_labels: node_labels.to_opt_strs(), @@ -671,7 +682,8 @@ mod tests { impl LabelledGraphWithEscStrs { fn new(name: &'static str, node_labels: Trivial, - edges: Vec) -> LabelledGraphWithEscStrs { + edges: Vec) + -> LabelledGraphWithEscStrs { LabelledGraphWithEscStrs { graph: LabelledGraph::new(name, node_labels, edges) } @@ -695,20 +707,24 @@ mod tests { None => LabelStr(id_name(n).name()), } } - fn edge_label(&'a self, e: & &'a Edge) -> LabelText<'a> { + fn edge_label(&'a self, e: &&'a Edge) -> LabelText<'a> { LabelStr(e.label.into_cow()) } } impl<'a> Labeller<'a, Node, &'a Edge> for LabelledGraphWithEscStrs { - fn graph_id(&'a self) -> Id<'a> { self.graph.graph_id() } - fn node_id(&'a self, n: &Node) -> Id<'a> { self.graph.node_id(n) } + fn graph_id(&'a self) -> Id<'a> { + self.graph.graph_id() + } + fn node_id(&'a self, n: &Node) -> Id<'a> { + self.graph.node_id(n) + } fn node_label(&'a self, n: &Node) -> LabelText<'a> { match self.graph.node_label(n) { LabelStr(s) | EscStr(s) => EscStr(s), } } - fn edge_label(&'a self, e: & &'a Edge) -> LabelText<'a> { + fn edge_label(&'a self, e: &&'a Edge) -> LabelText<'a> { match self.graph.edge_label(e) { LabelStr(s) | EscStr(s) => EscStr(s), } @@ -716,31 +732,31 @@ mod tests { } impl<'a> GraphWalk<'a, Node, &'a Edge> for LabelledGraph { - fn nodes(&'a self) -> Nodes<'a,Node> { + fn nodes(&'a self) -> Nodes<'a, Node> { (0..self.node_labels.len()).collect() } - fn edges(&'a self) -> Edges<'a,&'a Edge> { + fn edges(&'a self) -> Edges<'a, &'a Edge> { self.edges.iter().collect() } - fn source(&'a self, edge: & &'a Edge) -> Node { + fn source(&'a self, edge: &&'a Edge) -> Node { edge.from } - fn target(&'a self, edge: & &'a Edge) -> Node { + fn target(&'a self, edge: &&'a Edge) -> Node { edge.to } } impl<'a> GraphWalk<'a, Node, &'a Edge> for LabelledGraphWithEscStrs { - fn nodes(&'a self) -> Nodes<'a,Node> { + fn nodes(&'a self) -> Nodes<'a, Node> { self.graph.nodes() } - fn edges(&'a self) -> Edges<'a,&'a Edge> { + fn edges(&'a self) -> Edges<'a, &'a Edge> { self.graph.edges() } - fn source(&'a self, edge: & &'a Edge) -> Node { + fn source(&'a self, edge: &&'a Edge) -> Node { edge.from } - fn target(&'a self, edge: & &'a Edge) -> Node { + fn target(&'a self, edge: &&'a Edge) -> Node { edge.to } } @@ -781,8 +797,7 @@ r#"digraph single_node { #[test] fn single_edge() { let labels : Trivial = UnlabelledNodes(2); - let result = test_input(LabelledGraph::new("single_edge", labels, - vec!(edge(0, 1, "E")))); + let result = test_input(LabelledGraph::new("single_edge", labels, vec!(edge(0, 1, "E")))); assert_eq!(result.unwrap(), r#"digraph single_edge { N0[label="N0"]; @@ -795,7 +810,8 @@ r#"digraph single_edge { #[test] fn test_some_labelled() { let labels : Trivial = SomeNodesLabelled(vec![Some("A"), None]); - let result = test_input(LabelledGraph::new("test_some_labelled", labels, + let result = test_input(LabelledGraph::new("test_some_labelled", + labels, vec![edge(0, 1, "A-1")])); assert_eq!(result.unwrap(), r#"digraph test_some_labelled { @@ -809,8 +825,7 @@ r#"digraph test_some_labelled { #[test] fn single_cyclic_node() { let labels : Trivial = UnlabelledNodes(1); - let r = test_input(LabelledGraph::new("single_cyclic_node", labels, - vec!(edge(0, 0, "E")))); + let r = test_input(LabelledGraph::new("single_cyclic_node", labels, vec!(edge(0, 0, "E")))); assert_eq!(r.unwrap(), r#"digraph single_cyclic_node { N0[label="N0"]; @@ -822,10 +837,12 @@ r#"digraph single_cyclic_node { #[test] fn hasse_diagram() { let labels = AllNodesLabelled(vec!("{x,y}", "{x}", "{y}", "{}")); - let r = test_input(LabelledGraph::new( - "hasse_diagram", labels, - vec!(edge(0, 1, ""), edge(0, 2, ""), - edge(1, 3, ""), edge(2, 3, "")))); + let r = test_input(LabelledGraph::new("hasse_diagram", + labels, + vec!(edge(0, 1, ""), + edge(0, 2, ""), + edge(1, 3, ""), + edge(2, 3, "")))); assert_eq!(r.unwrap(), r#"digraph hasse_diagram { N0[label="{x,y}"]; @@ -856,10 +873,12 @@ r#"digraph hasse_diagram { let mut writer = Vec::new(); - let g = LabelledGraphWithEscStrs::new( - "syntax_tree", labels, - vec!(edge(0, 1, "then"), edge(0, 2, "else"), - edge(1, 3, ";"), edge(2, 3, ";" ))); + let g = LabelledGraphWithEscStrs::new("syntax_tree", + labels, + vec!(edge(0, 1, "then"), + edge(0, 2, "else"), + edge(1, 3, ";"), + edge(2, 3, ";" ))); render(&g, &mut writer).unwrap(); let mut r = String::new(); diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 7abe5a84c5fff..ca16e5277c554 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -26,9 +26,13 @@ #![feature(rustc_private)] #![feature(staged_api)] -#[macro_use] extern crate log; -#[macro_use] extern crate syntax; -#[macro_use] #[no_link] extern crate rustc_bitflags; +#[macro_use] +extern crate log; +#[macro_use] +extern crate syntax; +#[macro_use] +#[no_link] +extern crate rustc_bitflags; extern crate rustc; @@ -69,7 +73,8 @@ use syntax::ast::{ExprLoop, ExprWhile, ExprMethodCall}; use syntax::ast::{ExprPath, ExprStruct, FnDecl}; use syntax::ast::{ForeignItemFn, ForeignItemStatic, Generics}; use syntax::ast::{Ident, ImplItem, Item, ItemConst, ItemEnum, ItemExternCrate}; -use syntax::ast::{ItemFn, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic, ItemDefaultImpl}; +use syntax::ast::{ItemFn, ItemForeignMod, ItemImpl, ItemMac, ItemMod, + ItemStatic, ItemDefaultImpl}; use syntax::ast::{ItemStruct, ItemTrait, ItemTy, ItemUse}; use syntax::ast::{Local, MethodImplItem, Name, NodeId}; use syntax::ast::{Pat, PatEnum, PatIdent, PatLit, PatQPath}; @@ -195,9 +200,7 @@ impl<'a, 'v, 'tcx> Visitor<'v> for Resolver<'a, 'tcx> { fn visit_generics(&mut self, generics: &Generics) { self.resolve_generics(generics); } - fn visit_poly_trait_ref(&mut self, - tref: &ast::PolyTraitRef, - m: &ast::TraitBoundModifier) { + fn visit_poly_trait_ref(&mut self, tref: &ast::PolyTraitRef, m: &ast::TraitBoundModifier) { match self.resolve_trait_reference(tref.trait_ref.ref_id, &tref.trait_ref.path, 0) { Ok(def) => self.record_def(tref.trait_ref.ref_id, def), Err(_) => { /* error already reported */ } @@ -530,11 +533,7 @@ impl NameBindings { } else { DefModifiers::empty() } | DefModifiers::IMPORTABLE; - let module_ = Rc::new(Module::new(parent_link, - def_id, - kind, - external, - is_public)); + let module_ = Rc::new(Module::new(parent_link, def_id, kind, external, is_public)); let type_def = self.type_def.borrow().clone(); match type_def { None => { @@ -852,7 +851,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { fn new(session: &'a Session, ast_map: &'a ast_map::Map<'tcx>, crate_span: Span, - make_glob_map: MakeGlobMap) -> Resolver<'a, 'tcx> { + make_glob_map: MakeGlobMap) + -> Resolver<'a, 'tcx> { let graph_root = NameBindings::new(); graph_root.define_module(NoParentLink, @@ -975,9 +975,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { span: Span, name_search_type: NameSearchType, lp: LastPrivate) - -> ResolveResult<(Rc, LastPrivate)> { - fn search_parent_externals(needle: Name, module: &Rc) - -> Option> { + -> ResolveResult<(Rc, LastPrivate)> { + fn search_parent_externals(needle: Name, module: &Rc) -> Option> { match module.external_module_children.borrow().get(&needle) { Some(_) => Some(module.clone()), None => match module.parent_link { @@ -1198,7 +1197,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { module_: Rc, name: Name, namespace: Namespace) - -> ResolveResult<(Target, bool)> { + -> ResolveResult<(Target, bool)> { debug!("(resolving item in lexical scope) resolving `{}` in \ namespace {:?} in `{}`", token::get_name(name), @@ -1329,7 +1328,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { fn resolve_module_in_lexical_scope(&mut self, module_: Rc, name: Name) - -> ResolveResult> { + -> ResolveResult> { // If this module is an anonymous module, resolve the item in the // lexical scope. Otherwise, resolve the item from the crate root. let resolve_result = self.resolve_item_in_lexical_scope(module_, name, TypeNS); @@ -1370,8 +1369,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } /// Returns the nearest normal module parent of the given module. - fn get_nearest_normal_module_parent(&mut self, module_: Rc) - -> Option> { + fn get_nearest_normal_module_parent(&mut self, module_: Rc) -> Option> { let mut module_ = module_; loop { match module_.parent_link.clone() { @@ -1393,8 +1391,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { /// Returns the nearest normal module parent of the given module, or the /// module itself if it is a normal module. - fn get_nearest_normal_module_parent_or_self(&mut self, module_: Rc) - -> Rc { + fn get_nearest_normal_module_parent_or_self(&mut self, module_: Rc) -> Rc { match module_.kind.get() { NormalModuleKind => return module_, TraitModuleKind | @@ -1415,7 +1412,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { fn resolve_module_prefix(&mut self, module_: Rc, module_path: &[Name]) - -> ResolveResult { + -> ResolveResult { // Start at the current module if we see `self` or `super`, or at the // top of the crate otherwise. let mut containing_module; @@ -1608,8 +1605,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { // generate a fake "implementation scope" containing all the // implementations thus found, for compatibility with old resolve pass. - fn with_scope(&mut self, name: Option, f: F) where - F: FnOnce(&mut Resolver), + fn with_scope(&mut self, name: Option, f: F) + where F: FnOnce(&mut Resolver) { let orig_module = self.current_module.clone(); @@ -1651,11 +1648,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { /// Wraps the given definition in the appropriate number of `DefUpvar` /// wrappers. - fn upvarify(&self, - ribs: &[Rib], - def_like: DefLike, - span: Span) - -> Option { + fn upvarify(&self, ribs: &[Rib], def_like: DefLike, span: Span) -> Option { let mut def = match def_like { DlDef(def) => def, _ => return Some(def_like) @@ -1742,11 +1735,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { /// Searches the current set of local scopes and /// applies translations for closures. - fn search_ribs(&self, - ribs: &[Rib], - name: Name, - span: Span) - -> Option { + fn search_ribs(&self, ribs: &[Rib], name: Name, span: Span) -> Option { // FIXME #4950: Try caching? for (i, rib) in ribs.iter().enumerate().rev() { @@ -1915,8 +1904,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } - fn with_type_parameter_rib(&mut self, type_parameters: TypeParameters, f: F) where - F: FnOnce(&mut Resolver), + fn with_type_parameter_rib(&mut self, type_parameters: TypeParameters, f: F) + where F: FnOnce(&mut Resolver) { match type_parameters { HasTypeParameters(generics, space, rib_kind) => { @@ -1959,16 +1948,16 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } - fn with_label_rib(&mut self, f: F) where - F: FnOnce(&mut Resolver), + fn with_label_rib(&mut self, f: F) + where F: FnOnce(&mut Resolver) { self.label_ribs.push(Rib::new(NormalRibKind)); f(self); self.label_ribs.pop(); } - fn with_constant_rib(&mut self, f: F) where - F: FnOnce(&mut Resolver), + fn with_constant_rib(&mut self, f: F) + where F: FnOnce(&mut Resolver) { self.value_ribs.push(Rib::new(ConstantItemRibKind)); self.type_ribs.push(Rib::new(ConstantItemRibKind)); @@ -1977,10 +1966,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { self.value_ribs.pop(); } - fn resolve_function(&mut self, - rib_kind: RibKind, - declaration: &FnDecl, - block: &Block) { + fn resolve_function(&mut self, rib_kind: RibKind, declaration: &FnDecl, block: &Block) { // Create a value rib for the function. self.value_ribs.push(Rib::new(rib_kind)); @@ -2069,10 +2055,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { result } - fn with_optional_trait_ref(&mut self, - opt_trait_ref: Option<&TraitRef>, - f: F) - -> T + fn with_optional_trait_ref(&mut self, opt_trait_ref: Option<&TraitRef>, f: F) -> T where F: FnOnce(&mut Resolver, Option) -> T { let mut new_val = None; @@ -2203,7 +2186,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { // user and one 'x' came from the macro. fn binding_mode_map(&mut self, pat: &Pat) -> BindingMap { let mut result = HashMap::new(); - pat_bindings(&self.def_map, pat, |binding_mode, _id, sp, path1| { + pat_bindings(&self.def_map, + pat, + |binding_mode, _id, sp, path1| { let name = mtwt::resolve(path1.node); result.insert(name, BindingInfo { span: sp, @@ -2380,7 +2365,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { // pattern that binds them bindings_list: &mut HashMap) { let pat_id = pattern.id; - walk_pat(pattern, |pattern| { + walk_pat(pattern, + |pattern| { match pattern.node { PatIdent(binding_mode, ref path1, _) => { @@ -2618,7 +2604,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { }); } - fn resolve_bare_identifier_pattern(&mut self, name: Name, span: Span) + fn resolve_bare_identifier_pattern(&mut self, + name: Name, + span: Span) -> BareIdentifierPatternResolution { let module = self.current_module.clone(); match self.resolve_item_in_lexical_scope(module, @@ -2686,8 +2674,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { path: &Path, namespace: Namespace, check_ribs: bool) - -> AssocItemResolveResult - { + -> AssocItemResolveResult { match maybe_qself { Some(&ast::QSelf { position: 0, .. }) => return TypecheckRequired, @@ -2729,7 +2716,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { path: &Path, path_depth: usize, namespace: Namespace, - check_ribs: bool) -> Option { + check_ribs: bool) + -> Option { let span = path.span; let segments = &path.segments[..path.segments.len()-path_depth]; @@ -2928,7 +2916,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { span: Span, segments: &[ast::PathSegment], namespace: Namespace) - -> Option<(Def, LastPrivate)> { + -> Option<(Def, LastPrivate)> { let module_path = segments.init().iter() .map(|ps| ps.identifier.name) .collect::>(); @@ -3015,7 +3003,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { fn resolve_item_by_name_in_lexical_scope(&mut self, name: Name, namespace: Namespace) - -> Option<(Def, LastPrivate)> { + -> Option<(Def, LastPrivate)> { // Check the items. let module = self.current_module.clone(); match self.resolve_item_in_lexical_scope(module, @@ -3058,8 +3046,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } - fn with_no_errors(&mut self, f: F) -> T where - F: FnOnce(&mut Resolver) -> T, + fn with_no_errors(&mut self, f: F) -> T + where F: FnOnce(&mut Resolver) -> T { self.emit_errors = false; let rs = f(self); @@ -3074,8 +3062,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } fn find_fallback_in_self_type(&mut self, name: Name) -> FallbackSuggestion { - fn extract_path_and_node_id(t: &Ty, allow: FallbackChecks) - -> Option<(Path, NodeId, FallbackChecks)> { + fn extract_path_and_node_id(t: &Ty, + allow: FallbackChecks) + -> Option<(Path, NodeId, FallbackChecks)> { match t.node { TyPath(None, ref path) => Some((path.clone(), t.id, allow)), TyPtr(ref mut_ty) => extract_path_and_node_id(&*mut_ty.ty, OnlyTraitAndStatics), @@ -3087,8 +3076,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } - fn get_module(this: &mut Resolver, span: Span, name_path: &[ast::Name]) - -> Option> { + fn get_module(this: &mut Resolver, + span: Span, + name_path: &[ast::Name]) + -> Option> { let root = this.current_module.clone(); let last_name = name_path.last().unwrap(); @@ -3190,8 +3181,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { NoSuggestion } - fn find_best_match_for_name(&mut self, name: &str, max_distance: usize) - -> Option { + fn find_best_match_for_name(&mut self, name: &str, max_distance: usize) -> Option { let this = &mut *self; let mut maybes: Vec = Vec::new(); @@ -3459,9 +3449,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { debug!("(getting traits containing item) looking for '{}'", token::get_name(name)); - fn add_trait_info(found_traits: &mut Vec, - trait_def_id: DefId, - name: Name) { + fn add_trait_info(found_traits: &mut Vec, trait_def_id: DefId, name: Name) { debug!("(adding trait info) found trait {}:{} for method '{}'", trait_def_id.krate, trait_def_id.node, @@ -3548,9 +3536,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } fn enforce_default_binding_mode(&mut self, - pat: &Pat, - pat_binding_mode: BindingMode, - descr: &str) { + pat: &Pat, + pat_binding_mode: BindingMode, + descr: &str) { match pat_binding_mode { BindByValue(_) => {} BindByRef(..) => { diff --git a/src/librustc_trans/save/mod.rs b/src/librustc_trans/save/mod.rs index d80086da20315..659e5953db546 100644 --- a/src/librustc_trans/save/mod.rs +++ b/src/librustc_trans/save/mod.rs @@ -80,8 +80,8 @@ struct DxrVisitor<'l, 'tcx: 'l> { } impl <'l, 'tcx> DxrVisitor<'l, 'tcx> { - fn nest(&mut self, scope_id: NodeId, f: F) where - F: FnOnce(&mut DxrVisitor<'l, 'tcx>), + fn nest(&mut self, scope_id: NodeId, f: F) + where F: FnOnce(&mut DxrVisitor<'l, 'tcx>) { let parent_scope = self.cur_scope; self.cur_scope = scope_id; @@ -287,9 +287,11 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> { } } - fn process_method(&mut self, sig: &ast::MethodSig, + fn process_method(&mut self, + sig: &ast::MethodSig, body: Option<&ast::Block>, - id: ast::NodeId, name: ast::Name, + id: ast::NodeId, + name: ast::Name, span: Span) { if generated_code(span) { return; @@ -408,8 +410,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> { id); } - fn process_trait_ref(&mut self, - trait_ref: &ast::TraitRef) { + fn process_trait_ref(&mut self, trait_ref: &ast::TraitRef) { match self.lookup_type_ref(trait_ref.ref_id) { Some(id) => { let sub_span = self.span.sub_span_for_type_name(trait_ref.path.span); @@ -455,7 +456,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> { // Dump generic params bindings, then visit_generics fn process_generic_params(&mut self, - generics:&ast::Generics, + generics: &ast::Generics, full_span: Span, prefix: &str, id: NodeId) { @@ -515,8 +516,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> { item: &ast::Item, typ: &ast::Ty, mt: ast::Mutability, - expr: &ast::Expr) - { + expr: &ast::Expr) { let qualname = format!("::{}", self.analysis.ty_cx.map.path_to_string(item.id)); // If the variable is immutable, save the initialising expression. @@ -545,8 +545,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> { ident: &ast::Ident, span: Span, typ: &ast::Ty, - expr: &ast::Expr) - { + expr: &ast::Expr) { let qualname = format!("::{}", self.analysis.ty_cx.map.path_to_string(id)); let sub_span = self.span.sub_span_after_keyword(span, @@ -762,7 +761,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> { } fn process_mod(&mut self, - item: &ast::Item, // The module in question, represented as an item. + item: &ast::Item, // The module in question, represented as an item. m: &ast::Mod) { let qualname = format!("::{}", self.analysis.ty_cx.map.path_to_string(item.id)); @@ -945,9 +944,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> { visit::walk_expr_opt(self, base) } - fn process_method_call(&mut self, - ex: &ast::Expr, - args: &Vec>) { + fn process_method_call(&mut self, ex: &ast::Expr, args: &Vec>) { let method_map = self.analysis.ty_cx.method_map.borrow(); let method_callee = method_map.get(&ty::MethodCall::expr(ex.id)).unwrap(); let (def_id, decl_id) = match method_callee.origin { @@ -1002,7 +999,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> { visit::walk_exprs(self, &args[..]); } - fn process_pat(&mut self, p:&ast::Pat) { + fn process_pat(&mut self, p: &ast::Pat) { if generated_code(p.span) { return }