Simplify Resolver::resolve_macro_path.

There are only two call sites, and three of the arguments are identical
at both call sites. This commit removes those arguments and renames the
method accordingly.
This commit is contained in:
Nicholas Nethercote 2025-11-11 11:07:01 +11:00
parent 055d0d6aaf
commit 258a446c89
2 changed files with 6 additions and 15 deletions

View file

@ -458,14 +458,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
let mut result = Err(Determinacy::Determined);
for derive in parent_scope.derives {
let parent_scope = &ParentScope { derives: &[], ..*parent_scope };
match this.reborrow().resolve_macro_path(
match this.reborrow().resolve_derive_macro_path(
derive,
MacroKind::Derive,
parent_scope,
true,
force,
ignore_import,
None,
) {
Ok((Some(ext), _)) => {
if ext.helper_attrs.contains(&ident.name) {

View file

@ -395,14 +395,11 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
for (i, resolution) in entry.resolutions.iter_mut().enumerate() {
if resolution.exts.is_none() {
resolution.exts = Some(
match self.cm().resolve_macro_path(
match self.cm().resolve_derive_macro_path(
&resolution.path,
MacroKind::Derive,
&parent_scope,
true,
force,
None,
None,
) {
Ok((Some(ext), _)) => {
if !ext.helper_attrs.is_empty() {
@ -706,26 +703,23 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
Ok((ext, res))
}
pub(crate) fn resolve_macro_path<'r>(
pub(crate) fn resolve_derive_macro_path<'r>(
self: CmResolver<'r, 'ra, 'tcx>,
path: &ast::Path,
kind: MacroKind,
parent_scope: &ParentScope<'ra>,
trace: bool,
force: bool,
ignore_import: Option<Import<'ra>>,
suggestion_span: Option<Span>,
) -> Result<(Option<Arc<SyntaxExtension>>, Res), Determinacy> {
self.resolve_macro_or_delegation_path(
path,
kind,
MacroKind::Derive,
parent_scope,
trace,
true,
force,
None,
None,
ignore_import,
suggestion_span,
None,
)
}