Skip to content

Commit f4b9b8d

Browse files
committed
Auto merge of rust-lang#155209 - JonathanBrouwer:attr_cleanup2, r=jdonszelmann
Post-attribute ports cleanup pt. 1 (again) This is a re-implementation of most (but not all) of rust-lang#154808 The code is the same as in that PR, other than a few changes, I'll leave comments where I changed things. I did re-implement most of the commits rather than cherry-picking, so it's probably good to check the entire diff regardless r? @jdonszelmann
2 parents 01dfd31 + 1e793cd commit f4b9b8d

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

clippy_lints/src/cognitive_complexity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<'tcx> LateLintPass<'tcx> for CognitiveComplexity {
145145
def_id: LocalDefId,
146146
) {
147147
#[allow(deprecated)]
148-
if !cx.tcx.has_attr(def_id, sym::test) {
148+
if !cx.tcx.get_attrs(def_id, sym::test).next().is_some() {
149149
let expr = if kind.asyncness().is_async() {
150150
match get_async_fn_body(cx.tcx, body) {
151151
Some(b) => b,

clippy_utils/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,8 +2400,7 @@ pub fn is_hir_ty_cfg_dependant(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> bool {
24002400
if let TyKind::Path(QPath::Resolved(_, path)) = ty.kind
24012401
&& let Res::Def(_, def_id) = path.res
24022402
{
2403-
#[allow(deprecated)]
2404-
return cx.tcx.has_attr(def_id, sym::cfg) || cx.tcx.has_attr(def_id, sym::cfg_attr);
2403+
return find_attr!(cx.tcx, def_id, CfgTrace(..) | CfgAttrTrace);
24052404
}
24062405
false
24072406
}

0 commit comments

Comments
 (0)