Skip to content

Commit cae7b87

Browse files
committed
rustc: Remove unused Session argument from some attribute functions
1 parent 6db2d59 commit cae7b87

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clippy_lints/src/functions/must_use.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>
2828
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
2929
if let Some(attr) = attr {
3030
check_needless_must_use(cx, sig.decl, item.owner_id, item.span, fn_header_span, attr);
31-
} else if is_public && !is_proc_macro(cx.sess(), attrs) && !attrs.iter().any(|a| a.has_name(sym::no_mangle)) {
31+
} else if is_public && !is_proc_macro(attrs) && !attrs.iter().any(|a| a.has_name(sym::no_mangle)) {
3232
check_must_use_candidate(
3333
cx,
3434
sig.decl,
@@ -51,7 +51,7 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp
5151
if let Some(attr) = attr {
5252
check_needless_must_use(cx, sig.decl, item.owner_id, item.span, fn_header_span, attr);
5353
} else if is_public
54-
&& !is_proc_macro(cx.sess(), attrs)
54+
&& !is_proc_macro(attrs)
5555
&& trait_ref_of_method(cx, item.owner_id.def_id).is_none()
5656
{
5757
check_must_use_candidate(
@@ -78,7 +78,7 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr
7878
check_needless_must_use(cx, sig.decl, item.owner_id, item.span, fn_header_span, attr);
7979
} else if let hir::TraitFn::Provided(eid) = *eid {
8080
let body = cx.tcx.hir().body(eid);
81-
if attr.is_none() && is_public && !is_proc_macro(cx.sess(), attrs) {
81+
if attr.is_none() && is_public && !is_proc_macro(attrs) {
8282
check_must_use_candidate(
8383
cx,
8484
sig.decl,

clippy_utils/src/attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ pub fn get_unique_attr<'a>(
145145

146146
/// Return true if the attributes contain any of `proc_macro`,
147147
/// `proc_macro_derive` or `proc_macro_attribute`, false otherwise
148-
pub fn is_proc_macro(sess: &Session, attrs: &[ast::Attribute]) -> bool {
149-
attrs.iter().any(|attr| sess.is_proc_macro_attr(attr))
148+
pub fn is_proc_macro(attrs: &[ast::Attribute]) -> bool {
149+
attrs.iter().any(|attr| attr.is_proc_macro_attr())
150150
}
151151

152152
/// Return true if the attributes contain `#[doc(hidden)]`

0 commit comments

Comments
 (0)