Merge pull request #19749 from Veykril/push-tsxvxzzmlxpq

refactor: Remove unnecessary `AsAny` trait
This commit is contained in:
Lukas Wirth 2025-05-05 14:53:57 +00:00 committed by GitHub
commit d40455fec0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 56 deletions

View file

@ -19,18 +19,8 @@ pub enum ProcMacroKind {
Attr,
}
pub trait AsAny: Any {
fn as_any(&self) -> &dyn Any;
}
impl<T: Any> AsAny for T {
fn as_any(&self) -> &dyn Any {
self
}
}
/// A proc-macro expander implementation.
pub trait ProcMacroExpander: fmt::Debug + Send + Sync + RefUnwindSafe + AsAny {
pub trait ProcMacroExpander: fmt::Debug + Send + Sync + RefUnwindSafe + Any {
/// Run the expander with the given input subtree, optional attribute input subtree (for
/// [`ProcMacroKind::Attr`]), environment variables, and span information.
fn expand(
@ -44,7 +34,9 @@ pub trait ProcMacroExpander: fmt::Debug + Send + Sync + RefUnwindSafe + AsAny {
current_dir: String,
) -> Result<tt::TopSubtree, ProcMacroExpansionError>;
fn eq_dyn(&self, other: &dyn ProcMacroExpander) -> bool;
fn eq_dyn(&self, other: &dyn ProcMacroExpander) -> bool {
other.type_id() == self.type_id()
}
}
impl PartialEq for dyn ProcMacroExpander {