Rename get_outer_macro to macro_call_for_string_token

This commit is contained in:
btwotwo 2022-10-11 19:28:42 +02:00
parent 3c39668ca4
commit a807cc3afb
No known key found for this signature in database
GPG key ID: D456A0349D73A0A3
3 changed files with 6 additions and 8 deletions

View file

@ -3,8 +3,7 @@ use syntax::{
ast::{self, IsString},
TextRange, TextSize,
};
use super::node_ext::get_outer_macro;
use crate::syntax_helpers::node_ext::macro_call_for_string_token;
pub fn is_format_string(string: &ast::String) -> bool {
// Check if `string` is a format string argument of a macro invocation.
@ -16,7 +15,7 @@ pub fn is_format_string(string: &ast::String) -> bool {
// This setup lets us correctly highlight the components of `concat!("{}", "bla")` format
// strings. It still fails for `concat!("{", "}")`, but that is rare.
(|| {
let name = get_outer_macro(string)?.path()?.segment()?.name_ref()?;
let name = macro_call_for_string_token(string)?.path()?.segment()?.name_ref()?;
if !matches!(
name.text().as_str(),

View file

@ -458,7 +458,7 @@ pub fn parse_tt_as_comma_sep_paths(input: ast::TokenTree) -> Option<Vec<ast::Pat
Some(paths)
}
pub fn get_outer_macro(string: &ast::String) -> Option<MacroCall> {
pub fn macro_call_for_string_token(string: &ast::String) -> Option<MacroCall> {
let macro_call = string.syntax().parent_ancestors().find_map(ast::MacroCall::cast)?;
Some(macro_call)
}