mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
Apply suggestions from code review
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
This commit is contained in:
@@ -41,15 +41,20 @@ macro_rules! pre_emit {
|
||||
};
|
||||
($($_:tt)*) => {};
|
||||
}
|
||||
|
||||
// TODO: remove the mannually written Label conversions. These can be auto-generated by
|
||||
// changing the base class of AssocItem from AstNode to Item
|
||||
impl From<crate::trap::Label<generated::AssocItem>> for crate::trap::Label<generated::Item> {
|
||||
fn from(value: crate::trap::Label<generated::AssocItem>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Item is a subclass of Stmt
|
||||
// SAFETY: this is safe because every concrete instance of `@assoc_item` is also an instance of `@item`
|
||||
unsafe { Self::from_untyped(value.as_untyped()) }
|
||||
}
|
||||
}
|
||||
// TODO: remove the mannually written Label conversions. These can be auto-generated by
|
||||
// changing the base class of ExternItem from AstNode to Item
|
||||
impl From<crate::trap::Label<generated::ExternItem>> for crate::trap::Label<generated::Item> {
|
||||
fn from(value: crate::trap::Label<generated::ExternItem>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Item is a subclass of Stmt
|
||||
// SAFETY: this is safe because every concrete instance of `@extern_item` is also an instance of `@item`
|
||||
unsafe { Self::from_untyped(value.as_untyped()) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user