@@ -47,11 +47,11 @@ pub fn inject(sess: &Session, resolver: &mut dyn ResolverExpand, krate: &mut ast
4747 // unconditional, so that the attribute is still marked as used in
4848 // non-test builds.
4949 let reexport_test_harness_main =
50- sess . first_attr_value_str_by_name ( & krate. attrs , sym:: reexport_test_harness_main) ;
50+ attr :: first_attr_value_str_by_name ( & krate. attrs , sym:: reexport_test_harness_main) ;
5151
5252 // Do this here so that the test_runner crate attribute gets marked as used
5353 // even in non-test builds
54- let test_runner = get_test_runner ( sess , span_diagnostic, & krate) ;
54+ let test_runner = get_test_runner ( span_diagnostic, & krate) ;
5555
5656 if sess. opts . test {
5757 let panic_strategy = match ( panic_strategy, sess. opts . unstable_opts . panic_abort_tests ) {
@@ -123,7 +123,7 @@ impl<'a> MutVisitor for TestHarnessGenerator<'a> {
123123
124124 fn flat_map_item ( & mut self , i : P < ast:: Item > ) -> SmallVec < [ P < ast:: Item > ; 1 ] > {
125125 let mut item = i. into_inner ( ) ;
126- if let Some ( name) = get_test_name ( & self . cx . ext_cx . sess , & item) {
126+ if let Some ( name) = get_test_name ( & item) {
127127 debug ! ( "this is a test item" ) ;
128128
129129 let test = Test { span : item. span , ident : item. ident , name } ;
@@ -145,12 +145,12 @@ impl<'a> MutVisitor for TestHarnessGenerator<'a> {
145145
146146// Beware, this is duplicated in librustc_passes/entry.rs (with
147147// `rustc_hir::Item`), so make sure to keep them in sync.
148- fn entry_point_type ( sess : & Session , item : & ast:: Item , depth : usize ) -> EntryPointType {
148+ fn entry_point_type ( item : & ast:: Item , depth : usize ) -> EntryPointType {
149149 match item. kind {
150150 ast:: ItemKind :: Fn ( ..) => {
151- if sess . contains_name ( & item. attrs , sym:: start) {
151+ if attr :: contains_name ( & item. attrs , sym:: start) {
152152 EntryPointType :: Start
153- } else if sess . contains_name ( & item. attrs , sym:: rustc_main) {
153+ } else if attr :: contains_name ( & item. attrs , sym:: rustc_main) {
154154 EntryPointType :: RustcMainAttr
155155 } else if item. ident . name == sym:: main {
156156 if depth == 0 {
@@ -184,7 +184,7 @@ impl<'a> MutVisitor for EntryPointCleaner<'a> {
184184 // Remove any #[rustc_main] or #[start] from the AST so it doesn't
185185 // clash with the one we're going to add, but mark it as
186186 // #[allow(dead_code)] to avoid printing warnings.
187- let item = match entry_point_type ( self . sess , & item, self . depth ) {
187+ let item = match entry_point_type ( & item, self . depth ) {
188188 EntryPointType :: MainNamed | EntryPointType :: RustcMainAttr | EntryPointType :: Start => {
189189 item. map ( |ast:: Item { id, ident, attrs, kind, vis, span, tokens } | {
190190 let allow_dead_code = attr:: mk_attr_nested_word (
@@ -373,16 +373,12 @@ fn mk_tests_slice(cx: &TestCtxt<'_>, sp: Span) -> P<ast::Expr> {
373373 )
374374}
375375
376- fn get_test_name ( sess : & Session , i : & ast:: Item ) -> Option < Symbol > {
377- sess . first_attr_value_str_by_name ( & i. attrs , sym:: rustc_test_marker)
376+ fn get_test_name ( i : & ast:: Item ) -> Option < Symbol > {
377+ attr :: first_attr_value_str_by_name ( & i. attrs , sym:: rustc_test_marker)
378378}
379379
380- fn get_test_runner (
381- sess : & Session ,
382- sd : & rustc_errors:: Handler ,
383- krate : & ast:: Crate ,
384- ) -> Option < ast:: Path > {
385- let test_attr = sess. find_by_name ( & krate. attrs , sym:: test_runner) ?;
380+ fn get_test_runner ( sd : & rustc_errors:: Handler , krate : & ast:: Crate ) -> Option < ast:: Path > {
381+ let test_attr = attr:: find_by_name ( & krate. attrs , sym:: test_runner) ?;
386382 let meta_list = test_attr. meta_item_list ( ) ?;
387383 let span = test_attr. span ;
388384 match & * meta_list {
0 commit comments