Skip to content

Commit

Permalink
Cleanup formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed Nov 17, 2016
1 parent d8722f3 commit 6cb33a0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
35 changes: 18 additions & 17 deletions src/librustc_resolve/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,11 @@ impl<'b> Resolver<'b> {

// Constructs the reduced graph for one variant. Variants exist in the
// type and value namespaces.
fn build_reduced_graph_for_variant(
&mut self, variant: &Variant, parent: Module<'b>, vis: ty::Visibility, expansion: Mark,
) {
fn build_reduced_graph_for_variant(&mut self,
variant: &Variant,
parent: Module<'b>,
vis: ty::Visibility,
expansion: Mark) {
let name = variant.node.name.name;
let def_id = self.definitions.local_def_id(variant.node.data.id());

Expand All @@ -381,22 +383,20 @@ impl<'b> Resolver<'b> {
}

/// Constructs the reduced graph for one foreign item.
fn build_reduced_graph_for_foreign_item(
&mut self, foreign_item: &ForeignItem, expansion: Mark,
) {
fn build_reduced_graph_for_foreign_item(&mut self, item: &ForeignItem, expansion: Mark) {
let parent = self.current_module;
let name = foreign_item.ident.name;
let name = item.ident.name;

let def = match foreign_item.node {
let def = match item.node {
ForeignItemKind::Fn(..) => {
Def::Fn(self.definitions.local_def_id(foreign_item.id))
Def::Fn(self.definitions.local_def_id(item.id))
}
ForeignItemKind::Static(_, m) => {
Def::Static(self.definitions.local_def_id(foreign_item.id), m)
Def::Static(self.definitions.local_def_id(item.id), m)
}
};
let vis = self.resolve_visibility(&foreign_item.vis);
self.define(parent, name, ValueNS, (def, vis, foreign_item.span, expansion));
let vis = self.resolve_visibility(&item.vis);
self.define(parent, name, ValueNS, (def, vis, item.span, expansion));
}

fn build_reduced_graph_for_block(&mut self, block: &Block) {
Expand All @@ -415,8 +415,7 @@ impl<'b> Resolver<'b> {
}

/// Builds the reduced graph for a single item in an external crate.
fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'b>,
child: Export) {
fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'b>, child: Export) {
let name = child.name;
let def = child.def;
let def_id = def.def_id();
Expand Down Expand Up @@ -545,9 +544,11 @@ impl<'b> Resolver<'b> {
module.populated.set(true)
}

fn legacy_import_macro(
&mut self, name: Name, binding: &'b NameBinding<'b>, span: Span, allow_shadowing: bool,
) {
fn legacy_import_macro(&mut self,
name: Name,
binding: &'b NameBinding<'b>,
span: Span,
allow_shadowing: bool) {
self.used_crates.insert(binding.def().def_id().krate);
self.macro_names.insert(name);
if self.builtin_macros.insert(name, binding).is_some() && !allow_shadowing {
Expand Down
16 changes: 10 additions & 6 deletions src/librustc_resolve/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,11 @@ impl<'a> base::Resolver for Resolver<'a> {

impl<'a> Resolver<'a> {
// Resolve the name in the module's lexical scope, excluding non-items.
fn resolve_in_item_lexical_scope(
&mut self, name: Name, ns: Namespace, record_used: Option<Span>,
) -> Option<&'a NameBinding<'a>> {
fn resolve_in_item_lexical_scope(&mut self,
name: Name,
ns: Namespace,
record_used: Option<Span>)
-> Option<&'a NameBinding<'a>> {
let mut module = self.current_module;
let mut potential_expanded_shadower = None;
loop {
Expand Down Expand Up @@ -298,9 +300,11 @@ impl<'a> Resolver<'a> {
}
}

pub fn resolve_legacy_scope(
&mut self, mut scope: LegacyScope<'a>, name: ast::Name, record_used: bool,
) -> Option<MacroBinding<'a>> {
pub fn resolve_legacy_scope(&mut self,
mut scope: LegacyScope<'a>,
name: Name,
record_used: bool)
-> Option<MacroBinding<'a>> {
let mut possible_time_travel = None;
let mut relative_depth: u32 = 0;
let mut binding = None;
Expand Down

0 comments on commit 6cb33a0

Please sign in to comment.