9965: minor: Don't ask for the builtin attribute input twice r=Veykril a=Veykril

`tt` and `item` here were the same, I misunderstood what the main input for attributes was in #9943
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2021-08-21 10:56:09 +00:00 committed by GitHub
commit 6f41053ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View File

@ -18,12 +18,11 @@ macro_rules! register_builtin {
db: &dyn AstDatabase,
id: MacroCallId,
tt: &tt::Subtree,
item: &tt::Subtree,
) -> ExpandResult<tt::Subtree> {
let expander = match *self {
$( BuiltinAttrExpander::$variant => $expand, )*
};
expander(db, id, tt, item)
expander(db, id, tt)
}
fn find_by_name(name: &name::Name) -> Option<Self> {
@ -63,8 +62,7 @@ pub fn find_builtin_attr(
fn dummy_attr_expand(
_db: &dyn AstDatabase,
_id: MacroCallId,
_tt: &tt::Subtree,
item: &tt::Subtree,
tt: &tt::Subtree,
) -> ExpandResult<tt::Subtree> {
ExpandResult::ok(item.clone())
ExpandResult::ok(tt.clone())
}

View File

@ -53,10 +53,7 @@ impl TokenExpander {
TokenExpander::MacroRules { mac, .. } => mac.expand(tt),
TokenExpander::MacroDef { mac, .. } => mac.expand(tt),
TokenExpander::Builtin(it) => it.expand(db, id, tt),
TokenExpander::BuiltinAttr(it) => match db.macro_arg(id) {
Some(macro_arg) => it.expand(db, id, tt, &macro_arg.0),
None => mbe::ExpandResult::str_err("No item argument for attribute".to_string()),
},
TokenExpander::BuiltinAttr(it) => it.expand(db, id, tt),
TokenExpander::BuiltinDerive(it) => it.expand(db, id, tt),
TokenExpander::ProcMacro(_) => {
// We store the result in salsa db to prevent non-deterministic behavior in