Mark emplace_variable as must_use

This commit is contained in:
Ayaz Hafiz 2022-11-15 14:24:07 -06:00
parent 33a9c39cfd
commit ce5ca4a93c
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -585,8 +585,9 @@ impl Types {
/// # Safety /// # Safety
/// ///
/// May only be called if `var` is known to represent the type at `index`. /// May only be called if `var` is known to represent the type at `index`.
pub unsafe fn emplace_variable(&mut self, index: Index<TypeTag>, var: Variable) { #[must_use]
self.tags[index.index()] = TypeTag::Variable(var); pub unsafe fn emplace_variable(&mut self, index: Index<TypeTag>, var: Variable) -> TypeTag {
std::mem::replace(&mut self.tags[index.index()], TypeTag::Variable(var))
} }
fn reserve_type_tags(&mut self, length: usize) -> Slice<TypeTag> { fn reserve_type_tags(&mut self, length: usize) -> Slice<TypeTag> {