Fix clippy & rustdoc-json
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
This commit is contained in:
parent
a1844ec6c0
commit
3187aa751a
3 changed files with 5 additions and 4 deletions
|
|
@ -30,6 +30,7 @@ use rustc_span::edition::Edition::Edition2021;
|
|||
use rustc_span::{Span, Symbol, sym};
|
||||
use rustc_trait_selection::infer::TyCtxtInferExt;
|
||||
use rustc_trait_selection::traits::{Obligation, ObligationCause, Selection, SelectionContext};
|
||||
use rustc_attr_data_structures::{AttributeKind, find_attr};
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
|
|
@ -656,7 +657,7 @@ impl<'tcx> FormatArgsExpr<'_, 'tcx> {
|
|||
};
|
||||
let selection = SelectionContext::new(&infcx).select(&obligation);
|
||||
let derived = if let Ok(Some(Selection::UserDefined(data))) = selection {
|
||||
tcx.has_attr(data.impl_def_id, sym::automatically_derived)
|
||||
find_attr!(tcx.get_all_attrs(data.impl_def_id), AttributeKind::AutomaticallyDerived(..))
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ impl<'tcx> LateLintPass<'tcx> for DeriveDeserializeAllowingUnknown {
|
|||
}
|
||||
|
||||
// Is it derived?
|
||||
if !cx.tcx.has_attr(item.owner_id, sym::automatically_derived) {
|
||||
if !find_attr!(cx.tcx.get_all_attrs(item.owner_id), AttributeKind::AutomaticallyDerived(..)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1784,9 +1784,9 @@ pub fn in_automatically_derived(tcx: TyCtxt<'_>, id: HirId) -> bool {
|
|||
tcx.hir_parent_owner_iter(id)
|
||||
.filter(|(_, node)| matches!(node, OwnerNode::Item(item) if matches!(item.kind, ItemKind::Impl(_))))
|
||||
.any(|(id, _)| {
|
||||
has_attr(
|
||||
find_attr!(
|
||||
tcx.hir_attrs(tcx.local_def_id_to_hir_id(id.def_id)),
|
||||
sym::automatically_derived,
|
||||
AttributeKind::AutomaticallyDerived(..)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue