mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:14:52 +00:00
[ty] Remove unsafe salsa::Update
implementations in tuple.rs
(#19880)
This commit is contained in:
parent
ad28b80f96
commit
d76fd103ae
1 changed files with 0 additions and 50 deletions
|
@ -452,19 +452,6 @@ impl<'db> FixedLengthTuple<Type<'db>> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl<T> salsa::Update for FixedLengthTuple<T>
|
||||
where
|
||||
T: salsa::Update,
|
||||
{
|
||||
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool {
|
||||
unsafe {
|
||||
let old_value = &mut *old_pointer;
|
||||
Box::maybe_update(&raw mut old_value.0, new_value.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'db> PyIndex<'db> for &FixedLengthTuple<Type<'db>> {
|
||||
type Item = Type<'db>;
|
||||
|
||||
|
@ -847,21 +834,6 @@ impl<'db> VariableLengthTuple<Type<'db>> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl<T> salsa::Update for VariableLengthTuple<T>
|
||||
where
|
||||
T: salsa::Update,
|
||||
{
|
||||
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool {
|
||||
let old_value = unsafe { &mut *old_pointer };
|
||||
let mut changed = false;
|
||||
changed |= unsafe { Box::maybe_update(&raw mut old_value.prefix, new_value.prefix) };
|
||||
changed |= unsafe { T::maybe_update(&raw mut old_value.variable, new_value.variable) };
|
||||
changed |= unsafe { Box::maybe_update(&raw mut old_value.suffix, new_value.suffix) };
|
||||
changed
|
||||
}
|
||||
}
|
||||
|
||||
impl<'db> PyIndex<'db> for &VariableLengthTuple<Type<'db>> {
|
||||
type Item = Type<'db>;
|
||||
|
||||
|
@ -1149,28 +1121,6 @@ impl<T> From<VariableLengthTuple<T>> for Tuple<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl<T> salsa::Update for Tuple<T>
|
||||
where
|
||||
T: salsa::Update,
|
||||
{
|
||||
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool {
|
||||
let old_value = unsafe { &mut *old_pointer };
|
||||
match (old_value, new_value) {
|
||||
(Tuple::Fixed(old), Tuple::Fixed(new)) => unsafe {
|
||||
FixedLengthTuple::maybe_update(old, new)
|
||||
},
|
||||
(Tuple::Variable(old), Tuple::Variable(new)) => unsafe {
|
||||
VariableLengthTuple::maybe_update(old, new)
|
||||
},
|
||||
(old_value, new_value) => {
|
||||
*old_value = new_value;
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'db> PyIndex<'db> for &Tuple<Type<'db>> {
|
||||
type Item = Type<'db>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue