1
1
use 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,
4
4
} ;
5
5
use matches:: matches;
6
6
use rustc:: hir:: { self , def:: Res , def_id:: DefId , intravisit} ;
@@ -234,7 +234,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
234
234
check_needless_must_use ( cx, decl, item. hir_id , item. span , fn_header_span, attr) ;
235
235
return ;
236
236
}
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 ) {
238
238
check_must_use_candidate (
239
239
cx,
240
240
decl,
@@ -254,7 +254,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
254
254
if let Some ( attr) = attr {
255
255
let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
256
256
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 ) {
258
258
check_must_use_candidate (
259
259
cx,
260
260
& sig. decl ,
@@ -284,7 +284,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
284
284
let body = cx. tcx . hir ( ) . body ( eid) ;
285
285
Self :: check_raw_ptr ( cx, sig. header . unsafety , & sig. decl , body, item. hir_id ) ;
286
286
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 ) {
288
288
check_must_use_candidate (
289
289
cx,
290
290
& sig. decl ,
0 commit comments