Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/attr.rs')
-rw-r--r--crates/hir_def/src/attr.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs
index 383ad7f0c8..ca87b501aa 100644
--- a/crates/hir_def/src/attr.rs
+++ b/crates/hir_def/src/attr.rs
@@ -720,11 +720,8 @@ impl Attr {
Self::from_src(db, ast, hygiene, id)
}
- /// Parses this attribute as a `#[derive]`, returns an iterator that yields all contained paths
- /// to derive macros.
- ///
- /// Returns `None` when the attribute does not have a well-formed `#[derive]` attribute input.
- pub(crate) fn parse_derive(&self) -> Option<impl Iterator<Item = ModPath> + '_> {
+ /// Parses this attribute as a token tree consisting of comma separated paths.
+ pub fn parse_path_comma_token_tree(&self) -> Option<impl Iterator<Item = ModPath> + '_> {
let args = match self.input.as_deref() {
Some(AttrInput::TokenTree(args, _)) => args,
_ => return None,
@@ -749,7 +746,11 @@ impl Attr {
})
.collect::<Vec<_>>();
- return Some(paths.into_iter());
+ Some(paths.into_iter())
+ }
+
+ pub fn path(&self) -> &ModPath {
+ &self.path
}
pub fn string_value(&self) -> Option<&SmolStr> {