Skip to content

Commit da86b05

Browse files
authored
Remove deprecated Magnus calls in static_id (#535)
1 parent b9bc884 commit da86b05

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ext/src/helpers/static_id.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ pub struct StaticId(NonZeroUsize);
2222
impl StaticId {
2323
// Use `define_rb_intern!` instead, which uses this function.
2424
pub fn intern_str(id: &'static str) -> Self {
25-
let id: Id = magnus::StaticSymbol::new(id).into();
25+
let ruby = Ruby::get().unwrap();
26+
let id: Id = ruby.sym_new(id).into();
2627

2728
// SAFETY: Ruby will never return a `0` ID.
2829
StaticId(unsafe { NonZeroUsize::new_unchecked(id.as_raw() as _) })
@@ -39,7 +40,8 @@ impl IntoId for StaticId {
3940

4041
impl From<StaticId> for Symbol {
4142
fn from(static_id: StaticId) -> Self {
42-
let id: Id = static_id.into_id();
43+
let ruby = Ruby::get().unwrap();
44+
let id: Id = static_id.into_id_with(&ruby);
4345
id.into()
4446
}
4547
}

0 commit comments

Comments
 (0)