Skip to content

Commit ed61a64

Browse files
committed
rebasing
1 parent a642d85 commit ed61a64

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

src/librustc/lint/context.rs

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@ pub trait LintContext: Sized {
408408
fn lints(&self) -> &LintStore;
409409
fn mut_lints(&mut self) -> &mut LintStore;
410410
fn level_stack(&mut self) -> &mut Vec<(LintId, LevelSource)>;
411-
fn enter_attrs(&mut self, attrs: &[hir::Attribute]);
412-
fn exit_attrs(&mut self, attrs: &[hir::Attribute]);
411+
fn enter_attrs(&mut self, attrs: &[ast::Attribute]);
412+
fn exit_attrs(&mut self, attrs: &[ast::Attribute]);
413413

414414
/// Get the level of `lint` at the current position of the lint
415415
/// traversal.
@@ -510,14 +510,6 @@ pub trait LintContext: Sized {
510510
self.mut_lints().set_level(lint, lvlsrc);
511511
}
512512
}
513-
514-
fn with_ast_lint_attrs<F>(&mut self,
515-
attrs: &[ast::Attribute],
516-
f: F)
517-
where F: FnOnce(&mut Self),
518-
{
519-
self.with_lint_attrs(&lower_attrs(attrs), f)
520-
}
521513
}
522514

523515

@@ -596,11 +588,11 @@ impl<'a, 'tcx> LintContext for LateContext<'a, 'tcx> {
596588
&mut self.level_stack
597589
}
598590

599-
fn enter_attrs(&mut self, attrs: &[hir::Attribute]) {
591+
fn enter_attrs(&mut self, attrs: &[ast::Attribute]) {
600592
run_lints!(self, enter_lint_attrs, late_passes, attrs);
601593
}
602594

603-
fn exit_attrs(&mut self, attrs: &[hir::Attribute]) {
595+
fn exit_attrs(&mut self, attrs: &[ast::Attribute]) {
604596
run_lints!(self, exit_lint_attrs, late_passes, attrs);
605597
}
606598
}
@@ -623,11 +615,11 @@ impl<'a> LintContext for EarlyContext<'a> {
623615
&mut self.level_stack
624616
}
625617

626-
fn enter_attrs(&mut self, attrs: &[hir::Attribute]) {
618+
fn enter_attrs(&mut self, attrs: &[ast::Attribute]) {
627619
run_lints!(self, enter_lint_attrs, early_passes, attrs);
628620
}
629621

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

783775
impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
784776
fn visit_item(&mut self, it: &ast::Item) {
785-
self.with_ast_lint_attrs(&it.attrs, |cx| {
777+
self.with_lint_attrs(&it.attrs, |cx| {
786778
run_lints!(cx, check_item, early_passes, it);
787779
cx.visit_ids(|v| v.visit_item(it));
788780
ast_visit::walk_item(cx, it);
789781
})
790782
}
791783

792784
fn visit_foreign_item(&mut self, it: &ast::ForeignItem) {
793-
self.with_ast_lint_attrs(&it.attrs, |cx| {
785+
self.with_lint_attrs(&it.attrs, |cx| {
794786
run_lints!(cx, check_foreign_item, early_passes, it);
795787
ast_visit::walk_foreign_item(cx, it);
796788
})
@@ -828,14 +820,14 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
828820
}
829821

830822
fn visit_struct_field(&mut self, s: &ast::StructField) {
831-
self.with_ast_lint_attrs(&s.node.attrs, |cx| {
823+
self.with_lint_attrs(&s.node.attrs, |cx| {
832824
run_lints!(cx, check_struct_field, early_passes, s);
833825
ast_visit::walk_struct_field(cx, s);
834826
})
835827
}
836828

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

888880
fn visit_trait_item(&mut self, trait_item: &ast::TraitItem) {
889-
self.with_ast_lint_attrs(&trait_item.attrs, |cx| {
881+
self.with_lint_attrs(&trait_item.attrs, |cx| {
890882
run_lints!(cx, check_trait_item, early_passes, trait_item);
891883
cx.visit_ids(|v| v.visit_trait_item(trait_item));
892884
ast_visit::walk_trait_item(cx, trait_item);
893885
});
894886
}
895887

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

10291021
// Visit the whole crate.
1030-
cx.with_ast_lint_attrs(&krate.attrs, |cx| {
1022+
cx.with_lint_attrs(&krate.attrs, |cx| {
10311023
cx.visit_id(ast::CRATE_NODE_ID);
10321024
cx.visit_ids(|v| {
10331025
v.visited_outermost = true;

src/librustc/middle/ty/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,8 +2089,6 @@ impl<'tcx> ctxt<'tcx> {
20892089
hir::ExprCast(..) => {
20902090
false
20912091
}
2092-
2093-
hir::ExprParen(ref e) => self.expr_is_lval(e),
20942092
}
20952093
}
20962094

0 commit comments

Comments
 (0)