Skip to content

Commit e3b0e9d

Browse files
Remove deprecation_note from AttributeExt
1 parent f113540 commit e3b0e9d

3 files changed

Lines changed: 1 addition & 42 deletions

File tree

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -235,34 +235,6 @@ impl AttributeExt for Attribute {
235235
}
236236
}
237237

238-
fn deprecation_note(&self) -> Option<Ident> {
239-
match &self.kind {
240-
AttrKind::Normal(normal) if normal.item.path == sym::deprecated => {
241-
let meta = &normal.item;
242-
243-
// #[deprecated = "..."]
244-
if let Some(s) = meta.value_str() {
245-
return Some(Ident { name: s, span: meta.span() });
246-
}
247-
248-
// #[deprecated(note = "...")]
249-
if let Some(list) = meta.meta_item_list() {
250-
for nested in list {
251-
if let Some(mi) = nested.meta_item()
252-
&& mi.path == sym::note
253-
&& let Some(s) = mi.value_str()
254-
{
255-
return Some(Ident { name: s, span: mi.span });
256-
}
257-
}
258-
}
259-
260-
None
261-
}
262-
_ => None,
263-
}
264-
}
265-
266238
fn doc_resolution_scope(&self) -> Option<AttrStyle> {
267239
match &self.kind {
268240
AttrKind::DocComment(..) => Some(self.style),

compiler/rustc_hir/src/hir.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,14 +1415,6 @@ impl AttributeExt for Attribute {
14151415
}
14161416
}
14171417

1418-
#[inline]
1419-
fn deprecation_note(&self) -> Option<Ident> {
1420-
match &self {
1421-
Attribute::Parsed(AttributeKind::Deprecated { deprecation, .. }) => deprecation.note,
1422-
_ => None,
1423-
}
1424-
}
1425-
14261418
fn is_automatically_derived_attr(&self) -> bool {
14271419
matches!(self, Attribute::Parsed(AttributeKind::AutomaticallyDerived(..)))
14281420
}

src/librustdoc/clean/types.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use arrayvec::ArrayVec;
88
use itertools::Either;
99
use rustc_abi::{ExternAbi, VariantIdx};
1010
use rustc_ast as ast;
11-
use rustc_ast::attr::AttributeExt;
1211
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
1312
use rustc_data_structures::thin_vec::ThinVec;
1413
use rustc_hir as hir;
@@ -501,11 +500,7 @@ impl Item {
501500
}
502501

503502
pub(crate) fn attr_span(&self, tcx: TyCtxt<'_>) -> rustc_span::Span {
504-
let deprecation_notes = self
505-
.attrs
506-
.other_attrs
507-
.iter()
508-
.filter_map(|attr| attr.deprecation_note().map(|note| note.span));
503+
let deprecation_notes = find_attr!(&self.attrs.other_attrs, Deprecated { deprecation, .. } => deprecation.note.map(|note| note.span)).flatten();
509504

510505
span_of_fragments(&self.attrs.doc_strings)
511506
.into_iter()

0 commit comments

Comments
 (0)