Skip to content

Commit bd270cb

Browse files
Merge #6944
6944: Make attribute API more private r=jonas-schievink a=jonas-schievink bors r+ Co-authored-by: Jonas Schievink <[email protected]>
2 parents e47e7a0 + a2062d1 commit bd270cb

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

crates/hir_def/src/attr.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl From<Documentation> for String {
4242

4343
/// Syntactical attributes, without filtering of `cfg_attr`s.
4444
#[derive(Default, Debug, Clone, PartialEq, Eq)]
45-
pub struct RawAttrs {
45+
pub(crate) struct RawAttrs {
4646
entries: Option<Arc<[Attr]>>,
4747
}
4848

@@ -72,7 +72,7 @@ impl ops::Deref for Attrs {
7272
}
7373

7474
impl RawAttrs {
75-
pub const EMPTY: Self = Self { entries: None };
75+
pub(crate) const EMPTY: Self = Self { entries: None };
7676

7777
pub(crate) fn new(owner: &dyn AttrsOwner, hygiene: &Hygiene) -> Self {
7878
let (inner_attrs, inner_docs) = inner_attributes(owner.syntax())
@@ -241,18 +241,6 @@ impl Attrs {
241241
raw_attrs.filter(db, def.krate(db))
242242
}
243243

244-
pub fn merge(&self, other: Attrs) -> Attrs {
245-
match (&self.0.entries, &other.0.entries) {
246-
(None, None) => Attrs::EMPTY,
247-
(Some(entries), None) | (None, Some(entries)) => {
248-
Attrs(RawAttrs { entries: Some(entries.clone()) })
249-
}
250-
(Some(a), Some(b)) => {
251-
Attrs(RawAttrs { entries: Some(a.iter().chain(b.iter()).cloned().collect()) })
252-
}
253-
}
254-
}
255-
256244
pub fn by_key(&self, key: &'static str) -> AttrQuery<'_> {
257245
AttrQuery { attrs: self, key }
258246
}

0 commit comments

Comments
 (0)