From 81ccf37d3b8a5ffdf5c2d537761eeb06ae29dd7e Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sat, 19 Dec 2020 02:43:00 +0100 Subject: Remove `Attrs::merge` Only the `RawAttrs` version of this is in use --- crates/hir_def/src/attr.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index d1ed23947..aacfeef28 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs @@ -241,18 +241,6 @@ impl Attrs { raw_attrs.filter(db, def.krate(db)) } - pub fn merge(&self, other: Attrs) -> Attrs { - match (&self.0.entries, &other.0.entries) { - (None, None) => Attrs::EMPTY, - (Some(entries), None) | (None, Some(entries)) => { - Attrs(RawAttrs { entries: Some(entries.clone()) }) - } - (Some(a), Some(b)) => { - Attrs(RawAttrs { entries: Some(a.iter().chain(b.iter()).cloned().collect()) }) - } - } - } - pub fn by_key(&self, key: &'static str) -> AttrQuery<'_> { AttrQuery { attrs: self, key } } -- cgit v1.2.3 From a2062d18926f15e330c873eab97aed4d5d308ea1 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sat, 19 Dec 2020 02:44:00 +0100 Subject: Make `RawAttrs` crate-private There should be no need to use this from outside --- crates/hir_def/src/attr.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index aacfeef28..73b17da10 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs @@ -42,7 +42,7 @@ impl From for String { /// Syntactical attributes, without filtering of `cfg_attr`s. #[derive(Default, Debug, Clone, PartialEq, Eq)] -pub struct RawAttrs { +pub(crate) struct RawAttrs { entries: Option>, } @@ -72,7 +72,7 @@ impl ops::Deref for Attrs { } impl RawAttrs { - pub const EMPTY: Self = Self { entries: None }; + pub(crate) const EMPTY: Self = Self { entries: None }; pub(crate) fn new(owner: &dyn AttrsOwner, hygiene: &Hygiene) -> Self { let (inner_attrs, inner_docs) = inner_attributes(owner.syntax()) -- cgit v1.2.3