Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/lib.rs')
-rw-r--r--crates/hir_def/src/lib.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs
index c8e60032df..730523252c 100644
--- a/crates/hir_def/src/lib.rs
+++ b/crates/hir_def/src/lib.rs
@@ -781,12 +781,10 @@ fn attr_macro_as_call_id(
macro_attr: &Attr,
db: &dyn db::DefDatabase,
krate: CrateId,
- def: Option<MacroDefId>,
-) -> Result<MacroCallId, UnresolvedMacro> {
+ def: MacroDefId,
+) -> MacroCallId {
let attr_path = &item_attr.path;
- let def = def.ok_or_else(|| UnresolvedMacro { path: attr_path.clone() })?;
- let last_segment =
- attr_path.segments().last().ok_or_else(|| UnresolvedMacro { path: attr_path.clone() })?;
+ let last_segment = attr_path.segments().last().expect("empty attribute path");
let mut arg = match macro_attr.input.as_deref() {
Some(attr::AttrInput::TokenTree(tt, map)) => (tt.clone(), map.clone()),
_ => Default::default(),
@@ -805,5 +803,5 @@ fn attr_macro_as_call_id(
invoc_attr_index: macro_attr.id.ast_index,
},
);
- Ok(res)
+ res
}