fn is_valid_macrocall(macro_call: &ast::MacroCall, macro_name: &str) -> Option<bool> {
    let path = macro_call.path()?;
    let name_ref = path.segment()?.name_ref()?;

    // Make sure it is actually a dbg-macro call, dbg followed by !
    let excl = path.syntax().next_sibling_or_token()?;

    if name_ref.text() != macro_name || excl.kind() != T![!] {
        return None;
    }

    let node = macro_call.token_tree()?.syntax().clone();
    let first_child = node.first_child_or_token()?;
    let last_child = node.last_child_or_token()?;

    match (first_child.kind(), last_child.kind()) {
        (T!['('], T![')']) | (T!['['], T![']']) | (T!['{'], T!['}']) => Some(true),
        _ => Some(false),
    }
}
/// Verifies that the given macro_call actually matches the given name
/// and contains proper ending tokens
Verifies that the given macro_call actually matches the given name
and contains proper ending tokens
Verifies that the given macro_call actually matches the given name and contains proper ending tokens
fn is_valid_macrocall(macro_call: &ast::MacroCall, macro_name: &str) -> Option<bool> {
    let path = macro_call.path()?;
    let name_ref = path.segment()?.name_ref()?;
    // Make sure it is actually a dbg-macro call, dbg followed by !
    let excl = path.syntax().next_sibling_or_token()?;
    if name_ref.text() != macro_name || excl.kind() != T![!] {
        return None;
    }
    let node = macro_call.token_tree()?.syntax().clone();
    let first_child = node.first_child_or_token()?;
    let last_child = node.last_child_or_token()?;
    match (first_child.kind(), last_child.kind()) {
        (T!['('], T![')']) | (T!['['], T![']']) | (T!['{'], T!['}']) => Some(true),
        _ => Some(false),
    }
}
fn is_valid_macrocall ( macro_call : & ast :: MacroCall , macro_name : & str ) -> Option < bool > { let path = macro_call . path ( ) ? ; let name_ref = path . segment ( ) ? . name_ref ( ) ? ; // Make sure it is actually a dbg-macro call, dbg followed by ! let excl = path . syntax ( ) . next_sibling_or_token ( ) ? ; if name_ref . text ( ) != macro_name || excl . kind ( ) != T ! [ ] { return None ; } let node = macro_call . token_tree ( ) ? . syntax ( ) . clone ( ) ; let first_child = node . first_child_or_token ( ) ? ; let last_child = node . last_child_or_token ( ) ? ; match ( first_child . kind ( ) , last_child . kind ( ) ) { ( T ! [ '(' ] , T ! [ ')' ] ) | ( T ! [ '[' ] , T ! [ ']' ] ) | ( T ! [ '{' ] , T ! [ '}' ] ) => Some ( true ) , _ => Some ( false ) , } }
Verifies that the given macro_call actually matches the given name
and contains proper ending tokens
Verifies that the given macro_call actually matches the given name and contains proper ending tokens
macro_call
&ast::MacroCall
macro_name
&str