11use crate :: utils:: {
2- iter_input_pats, match_def_path, qpath_res, return_ty, snippet, snippet_opt, span_help_and_lint , span_lint ,
3- span_lint_and_then, type_is_unsafe_function,
2+ attrs :: is_proc_macro , iter_input_pats, match_def_path, qpath_res, return_ty, snippet, snippet_opt,
3+ span_help_and_lint , span_lint , span_lint_and_then, type_is_unsafe_function,
44} ;
55use matches:: matches;
66use rustc:: hir:: { self , def:: Res , def_id:: DefId , intravisit} ;
@@ -234,7 +234,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
234234 check_needless_must_use ( cx, decl, item. hir_id , item. span , fn_header_span, attr) ;
235235 return ;
236236 }
237- if cx. access_levels . is_exported ( item. hir_id ) {
237+ if cx. access_levels . is_exported ( item. hir_id ) && ! is_proc_macro ( & item . attrs ) {
238238 check_must_use_candidate (
239239 cx,
240240 decl,
@@ -254,7 +254,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
254254 if let Some ( attr) = attr {
255255 let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
256256 check_needless_must_use ( cx, & sig. decl , item. hir_id , item. span , fn_header_span, attr) ;
257- } else if cx. access_levels . is_exported ( item. hir_id ) {
257+ } else if cx. access_levels . is_exported ( item. hir_id ) && ! is_proc_macro ( & item . attrs ) {
258258 check_must_use_candidate (
259259 cx,
260260 & sig. decl ,
@@ -284,7 +284,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
284284 let body = cx. tcx . hir ( ) . body ( eid) ;
285285 Self :: check_raw_ptr ( cx, sig. header . unsafety , & sig. decl , body, item. hir_id ) ;
286286
287- if attr. is_none ( ) && cx. access_levels . is_exported ( item. hir_id ) {
287+ if attr. is_none ( ) && cx. access_levels . is_exported ( item. hir_id ) && ! is_proc_macro ( & item . attrs ) {
288288 check_must_use_candidate (
289289 cx,
290290 & sig. decl ,
0 commit comments