Skip to content

Commit

Permalink
rebasing
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Sep 17, 2015
1 parent a642d85 commit ed61a64
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
34 changes: 13 additions & 21 deletions src/librustc/lint/context.rs
Expand Up @@ -408,8 +408,8 @@ pub trait LintContext: Sized {
fn lints(&self) -> &LintStore;
fn mut_lints(&mut self) -> &mut LintStore;
fn level_stack(&mut self) -> &mut Vec<(LintId, LevelSource)>;
fn enter_attrs(&mut self, attrs: &[hir::Attribute]);
fn exit_attrs(&mut self, attrs: &[hir::Attribute]);
fn enter_attrs(&mut self, attrs: &[ast::Attribute]);
fn exit_attrs(&mut self, attrs: &[ast::Attribute]);

/// Get the level of `lint` at the current position of the lint
/// traversal.
Expand Down Expand Up @@ -510,14 +510,6 @@ pub trait LintContext: Sized {
self.mut_lints().set_level(lint, lvlsrc);
}
}

fn with_ast_lint_attrs<F>(&mut self,
attrs: &[ast::Attribute],
f: F)
where F: FnOnce(&mut Self),
{
self.with_lint_attrs(&lower_attrs(attrs), f)
}
}


Expand Down Expand Up @@ -596,11 +588,11 @@ impl<'a, 'tcx> LintContext for LateContext<'a, 'tcx> {
&mut self.level_stack
}

fn enter_attrs(&mut self, attrs: &[hir::Attribute]) {
fn enter_attrs(&mut self, attrs: &[ast::Attribute]) {
run_lints!(self, enter_lint_attrs, late_passes, attrs);
}

fn exit_attrs(&mut self, attrs: &[hir::Attribute]) {
fn exit_attrs(&mut self, attrs: &[ast::Attribute]) {
run_lints!(self, exit_lint_attrs, late_passes, attrs);
}
}
Expand All @@ -623,11 +615,11 @@ impl<'a> LintContext for EarlyContext<'a> {
&mut self.level_stack
}

fn enter_attrs(&mut self, attrs: &[hir::Attribute]) {
fn enter_attrs(&mut self, attrs: &[ast::Attribute]) {
run_lints!(self, enter_lint_attrs, early_passes, attrs);
}

fn exit_attrs(&mut self, attrs: &[hir::Attribute]) {
fn exit_attrs(&mut self, attrs: &[ast::Attribute]) {
run_lints!(self, exit_lint_attrs, early_passes, attrs);
}
}
Expand Down Expand Up @@ -782,15 +774,15 @@ impl<'a, 'tcx, 'v> hir_visit::Visitor<'v> for LateContext<'a, 'tcx> {

impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
fn visit_item(&mut self, it: &ast::Item) {
self.with_ast_lint_attrs(&it.attrs, |cx| {
self.with_lint_attrs(&it.attrs, |cx| {
run_lints!(cx, check_item, early_passes, it);
cx.visit_ids(|v| v.visit_item(it));
ast_visit::walk_item(cx, it);
})
}

fn visit_foreign_item(&mut self, it: &ast::ForeignItem) {
self.with_ast_lint_attrs(&it.attrs, |cx| {
self.with_lint_attrs(&it.attrs, |cx| {
run_lints!(cx, check_foreign_item, early_passes, it);
ast_visit::walk_foreign_item(cx, it);
})
Expand Down Expand Up @@ -828,14 +820,14 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
}

fn visit_struct_field(&mut self, s: &ast::StructField) {
self.with_ast_lint_attrs(&s.node.attrs, |cx| {
self.with_lint_attrs(&s.node.attrs, |cx| {
run_lints!(cx, check_struct_field, early_passes, s);
ast_visit::walk_struct_field(cx, s);
})
}

fn visit_variant(&mut self, v: &ast::Variant, g: &ast::Generics) {
self.with_ast_lint_attrs(&v.node.attrs, |cx| {
self.with_lint_attrs(&v.node.attrs, |cx| {
run_lints!(cx, check_variant, early_passes, v, g);
ast_visit::walk_variant(cx, v, g);
run_lints!(cx, check_variant_post, early_passes, v, g);
Expand Down Expand Up @@ -886,15 +878,15 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
}

fn visit_trait_item(&mut self, trait_item: &ast::TraitItem) {
self.with_ast_lint_attrs(&trait_item.attrs, |cx| {
self.with_lint_attrs(&trait_item.attrs, |cx| {
run_lints!(cx, check_trait_item, early_passes, trait_item);
cx.visit_ids(|v| v.visit_trait_item(trait_item));
ast_visit::walk_trait_item(cx, trait_item);
});
}

fn visit_impl_item(&mut self, impl_item: &ast::ImplItem) {
self.with_ast_lint_attrs(&impl_item.attrs, |cx| {
self.with_lint_attrs(&impl_item.attrs, |cx| {
run_lints!(cx, check_impl_item, early_passes, impl_item);
cx.visit_ids(|v| v.visit_impl_item(impl_item));
ast_visit::walk_impl_item(cx, impl_item);
Expand Down Expand Up @@ -1027,7 +1019,7 @@ pub fn check_ast_crate(sess: &Session, krate: &ast::Crate) {
let mut cx = EarlyContext::new(sess, krate);

// Visit the whole crate.
cx.with_ast_lint_attrs(&krate.attrs, |cx| {
cx.with_lint_attrs(&krate.attrs, |cx| {
cx.visit_id(ast::CRATE_NODE_ID);
cx.visit_ids(|v| {
v.visited_outermost = true;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/middle/ty/mod.rs
Expand Up @@ -2089,8 +2089,6 @@ impl<'tcx> ctxt<'tcx> {
hir::ExprCast(..) => {
false
}

hir::ExprParen(ref e) => self.expr_is_lval(e),
}
}

Expand Down

0 comments on commit ed61a64

Please sign in to comment.