@@ -37,13 +37,13 @@ use std::cell::RefCell;
3737use std:: cmp;
3838use std:: mem;
3939use syntax:: ast_util:: IdVisitingOperation ;
40- use rustc_front:: attr:: { self , AttrMetaMethods } ;
41- use rustc_front:: util;
40+ use syntax:: attr:: { self , AttrMetaMethods } ;
4241use syntax:: codemap:: Span ;
4342use syntax:: parse:: token:: InternedString ;
4443use syntax:: ast;
4544use rustc_front:: hir;
4645use rustc_front:: visit:: { self , Visitor , FnKind } ;
46+ use rustc_front:: util;
4747use syntax:: visit:: Visitor as SyntaxVisitor ;
4848use syntax:: diagnostic;
4949
@@ -286,7 +286,7 @@ macro_rules! run_lints { ($cx:expr, $f:ident, $($args:expr),*) => ({
286286/// Parse the lint attributes into a vector, with `Err`s for malformed lint
287287/// attributes. Writing this as an iterator is an enormous mess.
288288// See also the hir version just below.
289- pub fn gather_attrs ( attrs : & [ hir :: Attribute ] )
289+ pub fn gather_attrs ( attrs : & [ ast :: Attribute ] )
290290 -> Vec < Result < ( InternedString , Level , Span ) , Span > > {
291291 let mut out = vec ! ( ) ;
292292 for attr in attrs {
@@ -299,39 +299,7 @@ pub fn gather_attrs(attrs: &[hir::Attribute])
299299
300300 let meta = & attr. node . value ;
301301 let metas = match meta. node {
302- hir:: MetaList ( _, ref metas) => metas,
303- _ => {
304- out. push ( Err ( meta. span ) ) ;
305- continue ;
306- }
307- } ;
308-
309- for meta in metas {
310- out. push ( match meta. node {
311- hir:: MetaWord ( ref lint_name) => Ok ( ( lint_name. clone ( ) , level, meta. span ) ) ,
312- _ => Err ( meta. span ) ,
313- } ) ;
314- }
315- }
316- out
317- }
318- // Copy-pasted from the above function :-(
319- pub fn gather_attrs_from_hir ( attrs : & [ :: rustc_front:: hir:: Attribute ] )
320- -> Vec < Result < ( InternedString , Level , Span ) , Span > > {
321- use :: rustc_front:: attr:: AttrMetaMethods ;
322-
323- let mut out = vec ! ( ) ;
324- for attr in attrs {
325- let level = match Level :: from_str ( & attr. name ( ) ) {
326- None => continue ,
327- Some ( lvl) => lvl,
328- } ;
329-
330- :: rustc_front:: attr:: mark_used ( attr) ;
331-
332- let meta = & attr. node . value ;
333- let metas = match meta. node {
334- :: rustc_front:: hir:: MetaList ( _, ref metas) => metas,
302+ ast:: MetaList ( _, ref metas) => metas,
335303 _ => {
336304 out. push ( Err ( meta. span ) ) ;
337305 continue ;
@@ -340,9 +308,7 @@ pub fn gather_attrs_from_hir(attrs: &[::rustc_front::hir::Attribute])
340308
341309 for meta in metas {
342310 out. push ( match meta. node {
343- :: rustc_front:: hir:: MetaWord ( ref lint_name) => {
344- Ok ( ( lint_name. clone ( ) , level, meta. span ) )
345- }
311+ ast:: MetaWord ( ref lint_name) => Ok ( ( lint_name. clone ( ) , level, meta. span ) ) ,
346312 _ => Err ( meta. span ) ,
347313 } ) ;
348314 }
@@ -454,7 +420,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
454420 /// current lint context, call the provided function, then reset the
455421 /// lints in effect to their previous state.
456422 fn with_lint_attrs < F > ( & mut self ,
457- attrs : & [ hir :: Attribute ] ,
423+ attrs : & [ ast :: Attribute ] ,
458424 f : F ) where
459425 F : FnOnce ( & mut Context ) ,
460426 {
@@ -675,7 +641,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
675641 visit:: walk_path ( self , p) ;
676642 }
677643
678- fn visit_attribute ( & mut self , attr : & hir :: Attribute ) {
644+ fn visit_attribute ( & mut self , attr : & ast :: Attribute ) {
679645 run_lints ! ( self , check_attribute, attr) ;
680646 }
681647}
0 commit comments