Refine #[must_use]

This commit is contained in:
Stephen Chung 2022-11-28 16:36:40 +08:00
parent f458f18ffa
commit 29a397b216
11 changed files with 49 additions and 50 deletions

View File

@ -88,6 +88,7 @@ impl Engine {
/// ///
/// To define a pretty-print name, call [`with_name`][`TypeBuilder::with_name`], /// To define a pretty-print name, call [`with_name`][`TypeBuilder::with_name`],
/// to use [`Engine::register_type_with_name`] instead. /// to use [`Engine::register_type_with_name`] instead.
#[must_use]
pub struct TypeBuilder<'a, T: Variant + Clone> { pub struct TypeBuilder<'a, T: Variant + Clone> {
engine: &'a mut Engine, engine: &'a mut Engine,
name: Option<&'static str>, name: Option<&'static str>,

View File

@ -254,7 +254,7 @@ impl Engine {
// Check for data race. // Check for data race.
#[cfg(not(feature = "no_closure"))] #[cfg(not(feature = "no_closure"))]
crate::func::ensure_no_data_race(name, args, false).map(|_| Dynamic::UNIT)?; crate::func::ensure_no_data_race(name, args, false)?;
ast.shared_lib() ast.shared_lib()
.get_script_fn(name, args.len()) .get_script_fn(name, args.len())

View File

@ -29,6 +29,7 @@ impl Engine {
/// # } /// # }
/// ``` /// ```
#[inline(always)] #[inline(always)]
#[must_use]
pub fn definitions(&self) -> Definitions { pub fn definitions(&self) -> Definitions {
Definitions { Definitions {
engine: self, engine: self,
@ -55,6 +56,7 @@ impl Engine {
/// # } /// # }
/// ``` /// ```
#[inline(always)] #[inline(always)]
#[must_use]
pub fn definitions_with_scope<'e>(&'e self, scope: &'e Scope<'e>) -> Definitions<'e> { pub fn definitions_with_scope<'e>(&'e self, scope: &'e Scope<'e>) -> Definitions<'e> {
Definitions { Definitions {
engine: self, engine: self,
@ -67,7 +69,6 @@ impl Engine {
/// Internal configuration for module generation. /// Internal configuration for module generation.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
#[non_exhaustive] #[non_exhaustive]
#[must_use]
pub struct DefinitionsConfig { pub struct DefinitionsConfig {
/// Write `module ...` headers in definition files (default `false`). /// Write `module ...` headers in definition files (default `false`).
pub write_headers: bool, pub write_headers: bool,
@ -77,6 +78,7 @@ pub struct DefinitionsConfig {
impl Default for DefinitionsConfig { impl Default for DefinitionsConfig {
#[inline(always)] #[inline(always)]
#[must_use]
fn default() -> Self { fn default() -> Self {
Self { Self {
write_headers: false, write_headers: false,
@ -89,7 +91,6 @@ impl Default for DefinitionsConfig {
/// contents of an [`Engine`]. /// contents of an [`Engine`].
/// Exported under the `internals` and `metadata` feature only. /// Exported under the `internals` and `metadata` feature only.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[must_use]
pub struct Definitions<'e> { pub struct Definitions<'e> {
/// The [`Engine`]. /// The [`Engine`].
engine: &'e Engine, engine: &'e Engine,
@ -104,12 +105,14 @@ impl Definitions<'_> {
/// Headers are always present in content that is expected to be written to a file /// Headers are always present in content that is expected to be written to a file
/// (i.e. `write_to*` and `*_file` methods). /// (i.e. `write_to*` and `*_file` methods).
#[inline(always)] #[inline(always)]
#[must_use]
pub const fn with_headers(mut self, headers: bool) -> Self { pub const fn with_headers(mut self, headers: bool) -> Self {
self.config.write_headers = headers; self.config.write_headers = headers;
self self
} }
/// Include standard packages when writing definition files. /// Include standard packages when writing definition files.
#[inline(always)] #[inline(always)]
#[must_use]
pub const fn include_standard_packages(mut self, include_standard_packages: bool) -> Self { pub const fn include_standard_packages(mut self, include_standard_packages: bool) -> Self {
self.config.include_standard_packages = include_standard_packages; self.config.include_standard_packages = include_standard_packages;
self self
@ -128,6 +131,7 @@ impl Definitions<'_> {
} }
/// Get the configuration. /// Get the configuration.
#[inline(always)] #[inline(always)]
#[must_use]
pub(crate) const fn config(&self) -> &DefinitionsConfig { pub(crate) const fn config(&self) -> &DefinitionsConfig {
&self.config &self.config
} }
@ -392,6 +396,7 @@ impl Definitions<'_> {
impl Module { impl Module {
/// Return definitions for all items inside the [`Module`]. /// Return definitions for all items inside the [`Module`].
#[cfg(not(feature = "no_module"))] #[cfg(not(feature = "no_module"))]
#[must_use]
fn definition(&self, def: &Definitions) -> String { fn definition(&self, def: &Definitions) -> String {
let mut s = String::new(); let mut s = String::new();
self.write_definition(&mut s, def).unwrap(); self.write_definition(&mut s, def).unwrap();
@ -537,6 +542,7 @@ impl FuncInfo {
/// It tries to flatten types, removing `&` and `&mut`, and paths, while keeping generics. /// It tries to flatten types, removing `&` and `&mut`, and paths, while keeping generics.
/// ///
/// Associated generic types are also rewritten into regular generic type parameters. /// Associated generic types are also rewritten into regular generic type parameters.
#[must_use]
fn def_type_name<'a>(ty: &'a str, engine: &'a Engine) -> Cow<'a, str> { fn def_type_name<'a>(ty: &'a str, engine: &'a Engine) -> Cow<'a, str> {
let ty = engine.format_type_name(ty).replace("crate::", ""); let ty = engine.format_type_name(ty).replace("crate::", "");
let ty = ty.strip_prefix("&mut").unwrap_or(&*ty).trim(); let ty = ty.strip_prefix("&mut").unwrap_or(&*ty).trim();

View File

@ -599,7 +599,9 @@ impl Engine {
// Try to call index setter if value is changed // Try to call index setter if value is changed
let idx = &mut idx_val_for_setter; let idx = &mut idx_val_for_setter;
let new_val = &mut new_val; let new_val = &mut new_val;
self.call_indexer_set( // The return value of a indexer setter (usually `()`) is thrown away and not used.
let _ = self
.call_indexer_set(
global, caches, target, idx, new_val, is_ref_mut, op_pos, global, caches, target, idx, new_val, is_ref_mut, op_pos,
) )
.or_else(|e| match *e { .or_else(|e| match *e {
@ -659,8 +661,8 @@ impl Engine {
// Try to call index setter // Try to call index setter
let new_val = &mut new_val; let new_val = &mut new_val;
// The return value of a indexer setter (usually `()`) is thrown away and not used.
self.call_indexer_set( let _ = self.call_indexer_set(
global, caches, target, idx_val, new_val, is_ref_mut, op_pos, global, caches, target, idx_val, new_val, is_ref_mut, op_pos,
)?; )?;
} }
@ -981,7 +983,9 @@ impl Engine {
// Re-use args because the first &mut parameter will not be consumed // Re-use args because the first &mut parameter will not be consumed
let mut arg_values = [target.as_mut(), val.as_mut()]; let mut arg_values = [target.as_mut(), val.as_mut()];
let args = &mut arg_values; let args = &mut arg_values;
self.exec_native_fn_call( // The return value is thrown away and not used.
let _ = self
.exec_native_fn_call(
global, global,
caches, caches,
setter, setter,
@ -991,8 +995,7 @@ impl Engine {
is_ref_mut, is_ref_mut,
pos, pos,
) )
.or_else( .or_else(|err| match *err {
|err| match *err {
// Try an indexer if property does not exist // Try an indexer if property does not exist
ERR::ErrorDotExpr(..) => { ERR::ErrorDotExpr(..) => {
let idx = &mut name.into(); let idx = &mut name.into();
@ -1011,8 +1014,7 @@ impl Engine {
}) })
} }
_ => Err(err), _ => Err(err),
}, })?;
)?;
} }
Ok((result, may_be_changed)) Ok((result, may_be_changed))

View File

@ -81,6 +81,7 @@ pub fn calc_index<E>(
/// A type that encapsulates a mutation target for an expression with side effects. /// A type that encapsulates a mutation target for an expression with side effects.
#[derive(Debug)] #[derive(Debug)]
#[must_use]
pub enum Target<'a> { pub enum Target<'a> {
/// The target is a mutable reference to a [`Dynamic`]. /// The target is a mutable reference to a [`Dynamic`].
RefMut(&'a mut Dynamic), RefMut(&'a mut Dynamic),
@ -195,7 +196,6 @@ impl<'a> Target<'a> {
} }
/// Get the value of the [`Target`] as a [`Dynamic`], cloning a referenced value if necessary. /// Get the value of the [`Target`] as a [`Dynamic`], cloning a referenced value if necessary.
#[inline] #[inline]
#[must_use]
pub fn take_or_clone(self) -> Dynamic { pub fn take_or_clone(self) -> Dynamic {
match self { match self {
Self::RefMut(r) => r.clone(), // Referenced value is cloned Self::RefMut(r) => r.clone(), // Referenced value is cloned
@ -223,7 +223,6 @@ impl<'a> Target<'a> {
} }
/// Convert a shared or reference [`Target`] into a target with an owned value. /// Convert a shared or reference [`Target`] into a target with an owned value.
#[inline(always)] #[inline(always)]
#[must_use]
pub fn into_owned(self) -> Self { pub fn into_owned(self) -> Self {
match self { match self {
Self::RefMut(r) => Self::TempValue(r.clone()), Self::RefMut(r) => Self::TempValue(r.clone()),
@ -437,7 +436,6 @@ impl AsMut<Dynamic> for Target<'_> {
impl<T: Into<Dynamic>> From<T> for Target<'_> { impl<T: Into<Dynamic>> From<T> for Target<'_> {
#[inline(always)] #[inline(always)]
#[must_use]
fn from(value: T) -> Self { fn from(value: T) -> Self {
Self::TempValue(value.into()) Self::TempValue(value.into())
} }

View File

@ -2105,7 +2105,8 @@ impl Module {
global.source = orig_source; global.source = orig_source;
result?; // The return value is thrown away and not used
let _ = result?;
// Variables with an alias left in the scope become module variables // Variables with an alias left in the scope become module variables
for (_name, value, mut aliases) in scope { for (_name, value, mut aliases) in scope {

View File

@ -65,6 +65,7 @@ impl CustomTypesCollection {
} }
/// Find a custom type. /// Find a custom type.
#[inline(always)] #[inline(always)]
#[must_use]
pub fn get(&self, key: &str) -> Option<&CustomTypeInfo> { pub fn get(&self, key: &str) -> Option<&CustomTypeInfo> {
self.0.get(key) self.0.get(key)
} }

View File

@ -49,11 +49,13 @@ pub type Tag = i16;
const DEFAULT_TAG_VALUE: Tag = 0; const DEFAULT_TAG_VALUE: Tag = 0;
/// Dynamic type containing any value. /// Dynamic type containing any value.
#[must_use]
pub struct Dynamic(pub(crate) Union); pub struct Dynamic(pub(crate) Union);
/// Internal [`Dynamic`] representation. /// Internal [`Dynamic`] representation.
/// ///
/// Most variants are boxed to reduce the size. /// Most variants are boxed to reduce the size.
#[must_use]
pub enum Union { pub enum Union {
/// An error value which should not exist. /// An error value which should not exist.
Null, Null,
@ -107,10 +109,12 @@ pub enum Union {
/// This type provides transparent interoperability between normal [`Dynamic`] and shared /// This type provides transparent interoperability between normal [`Dynamic`] and shared
/// [`Dynamic`] values. /// [`Dynamic`] values.
#[derive(Debug)] #[derive(Debug)]
#[must_use]
pub struct DynamicReadLock<'d, T: Clone>(DynamicReadLockInner<'d, T>); pub struct DynamicReadLock<'d, T: Clone>(DynamicReadLockInner<'d, T>);
/// Different types of read guards for [`DynamicReadLock`]. /// Different types of read guards for [`DynamicReadLock`].
#[derive(Debug)] #[derive(Debug)]
#[must_use]
enum DynamicReadLockInner<'d, T: Clone> { enum DynamicReadLockInner<'d, T: Clone> {
/// A simple reference to a non-shared value. /// A simple reference to a non-shared value.
Reference(&'d T), Reference(&'d T),
@ -139,10 +143,12 @@ impl<'d, T: Any + Clone> Deref for DynamicReadLock<'d, T> {
/// This type provides transparent interoperability between normal [`Dynamic`] and shared /// This type provides transparent interoperability between normal [`Dynamic`] and shared
/// [`Dynamic`] values. /// [`Dynamic`] values.
#[derive(Debug)] #[derive(Debug)]
#[must_use]
pub struct DynamicWriteLock<'d, T: Clone>(DynamicWriteLockInner<'d, T>); pub struct DynamicWriteLock<'d, T: Clone>(DynamicWriteLockInner<'d, T>);
/// Different types of write guards for [`DynamicReadLock`]. /// Different types of write guards for [`DynamicReadLock`].
#[derive(Debug)] #[derive(Debug)]
#[must_use]
enum DynamicWriteLockInner<'d, T: Clone> { enum DynamicWriteLockInner<'d, T: Clone> {
/// A simple mutable reference to a non-shared value. /// A simple mutable reference to a non-shared value.
Reference(&'d mut T), Reference(&'d mut T),
@ -686,7 +692,6 @@ impl Clone for Dynamic {
impl Default for Dynamic { impl Default for Dynamic {
#[inline(always)] #[inline(always)]
#[must_use]
fn default() -> Self { fn default() -> Self {
Self::UNIT Self::UNIT
} }
@ -852,19 +857,16 @@ impl Dynamic {
/// Create a new [`Dynamic`] from a [`bool`]. /// Create a new [`Dynamic`] from a [`bool`].
#[inline(always)] #[inline(always)]
#[must_use]
pub const fn from_bool(value: bool) -> Self { pub const fn from_bool(value: bool) -> Self {
Self(Union::Bool(value, DEFAULT_TAG_VALUE, ReadWrite)) Self(Union::Bool(value, DEFAULT_TAG_VALUE, ReadWrite))
} }
/// Create a new [`Dynamic`] from an [`INT`]. /// Create a new [`Dynamic`] from an [`INT`].
#[inline(always)] #[inline(always)]
#[must_use]
pub const fn from_int(value: INT) -> Self { pub const fn from_int(value: INT) -> Self {
Self(Union::Int(value, DEFAULT_TAG_VALUE, ReadWrite)) Self(Union::Int(value, DEFAULT_TAG_VALUE, ReadWrite))
} }
/// Create a new [`Dynamic`] from a [`char`]. /// Create a new [`Dynamic`] from a [`char`].
#[inline(always)] #[inline(always)]
#[must_use]
pub const fn from_char(value: char) -> Self { pub const fn from_char(value: char) -> Self {
Self(Union::Char(value, DEFAULT_TAG_VALUE, ReadWrite)) Self(Union::Char(value, DEFAULT_TAG_VALUE, ReadWrite))
} }
@ -873,7 +875,6 @@ impl Dynamic {
/// Not available under `no_float`. /// Not available under `no_float`.
#[cfg(not(feature = "no_float"))] #[cfg(not(feature = "no_float"))]
#[inline(always)] #[inline(always)]
#[must_use]
pub const fn from_float(value: crate::FLOAT) -> Self { pub const fn from_float(value: crate::FLOAT) -> Self {
Self(Union::Float( Self(Union::Float(
super::FloatWrapper::new(value), super::FloatWrapper::new(value),
@ -886,28 +887,24 @@ impl Dynamic {
/// Exported under the `decimal` feature only. /// Exported under the `decimal` feature only.
#[cfg(feature = "decimal")] #[cfg(feature = "decimal")]
#[inline(always)] #[inline(always)]
#[must_use]
pub fn from_decimal(value: rust_decimal::Decimal) -> Self { pub fn from_decimal(value: rust_decimal::Decimal) -> Self {
Self(Union::Decimal(value.into(), DEFAULT_TAG_VALUE, ReadWrite)) Self(Union::Decimal(value.into(), DEFAULT_TAG_VALUE, ReadWrite))
} }
/// Create a [`Dynamic`] from an [`Array`][crate::Array]. /// Create a [`Dynamic`] from an [`Array`][crate::Array].
#[cfg(not(feature = "no_index"))] #[cfg(not(feature = "no_index"))]
#[inline(always)] #[inline(always)]
#[must_use]
pub fn from_array(array: crate::Array) -> Self { pub fn from_array(array: crate::Array) -> Self {
Self(Union::Array(array.into(), DEFAULT_TAG_VALUE, ReadWrite)) Self(Union::Array(array.into(), DEFAULT_TAG_VALUE, ReadWrite))
} }
/// Create a [`Dynamic`] from a [`Blob`][crate::Blob]. /// Create a [`Dynamic`] from a [`Blob`][crate::Blob].
#[cfg(not(feature = "no_index"))] #[cfg(not(feature = "no_index"))]
#[inline(always)] #[inline(always)]
#[must_use]
pub fn from_blob(blob: crate::Blob) -> Self { pub fn from_blob(blob: crate::Blob) -> Self {
Self(Union::Blob(blob.into(), DEFAULT_TAG_VALUE, ReadWrite)) Self(Union::Blob(blob.into(), DEFAULT_TAG_VALUE, ReadWrite))
} }
/// Create a [`Dynamic`] from a [`Map`][crate::Map]. /// Create a [`Dynamic`] from a [`Map`][crate::Map].
#[cfg(not(feature = "no_object"))] #[cfg(not(feature = "no_object"))]
#[inline(always)] #[inline(always)]
#[must_use]
pub fn from_map(map: crate::Map) -> Self { pub fn from_map(map: crate::Map) -> Self {
Self(Union::Map(map.into(), DEFAULT_TAG_VALUE, ReadWrite)) Self(Union::Map(map.into(), DEFAULT_TAG_VALUE, ReadWrite))
} }
@ -916,7 +913,6 @@ impl Dynamic {
/// Not available under `no-std` or `no_time`. /// Not available under `no-std` or `no_time`.
#[cfg(not(feature = "no_time"))] #[cfg(not(feature = "no_time"))]
#[inline(always)] #[inline(always)]
#[must_use]
pub fn from_timestamp(value: Instant) -> Self { pub fn from_timestamp(value: Instant) -> Self {
Self(Union::TimeStamp(value.into(), DEFAULT_TAG_VALUE, ReadWrite)) Self(Union::TimeStamp(value.into(), DEFAULT_TAG_VALUE, ReadWrite))
} }
@ -991,7 +987,6 @@ impl Dynamic {
} }
/// Make this [`Dynamic`] read-only (i.e. a constant). /// Make this [`Dynamic`] read-only (i.e. a constant).
#[inline(always)] #[inline(always)]
#[must_use]
pub fn into_read_only(self) -> Self { pub fn into_read_only(self) -> Self {
let mut value = self; let mut value = self;
value.set_access_mode(AccessMode::ReadOnly); value.set_access_mode(AccessMode::ReadOnly);
@ -1085,7 +1080,6 @@ impl Dynamic {
/// assert_eq!(new_result.to_string(), "hello"); /// assert_eq!(new_result.to_string(), "hello");
/// ``` /// ```
#[inline] #[inline]
#[must_use]
pub fn from<T: Variant + Clone>(value: T) -> Self { pub fn from<T: Variant + Clone>(value: T) -> Self {
// Coded this way in order to maximally leverage potentials for dead-code removal. // Coded this way in order to maximally leverage potentials for dead-code removal.
@ -1143,7 +1137,6 @@ impl Dynamic {
/// If the [`Dynamic`] value is already shared, this method returns itself. /// If the [`Dynamic`] value is already shared, this method returns itself.
#[cfg(not(feature = "no_closure"))] #[cfg(not(feature = "no_closure"))]
#[inline] #[inline]
#[must_use]
pub fn into_shared(self) -> Self { pub fn into_shared(self) -> Self {
let _access = self.access_mode(); let _access = self.access_mode();
@ -1365,7 +1358,6 @@ impl Dynamic {
/// ///
/// If the [`Dynamic`] is a shared value, it returns a cloned copy of the shared value. /// If the [`Dynamic`] is a shared value, it returns a cloned copy of the shared value.
#[inline] #[inline]
#[must_use]
pub fn flatten_clone(&self) -> Self { pub fn flatten_clone(&self) -> Self {
match self.0 { match self.0 {
#[cfg(not(feature = "no_closure"))] #[cfg(not(feature = "no_closure"))]
@ -1380,7 +1372,6 @@ impl Dynamic {
/// If the [`Dynamic`] is a shared value, it returns the shared value if there are no /// If the [`Dynamic`] is a shared value, it returns the shared value if there are no
/// outstanding references, or a cloned copy. /// outstanding references, or a cloned copy.
#[inline] #[inline]
#[must_use]
pub fn flatten(self) -> Self { pub fn flatten(self) -> Self {
match self.0 { match self.0 {
#[cfg(not(feature = "no_closure"))] #[cfg(not(feature = "no_closure"))]
@ -1451,7 +1442,6 @@ impl Dynamic {
/// Under the `sync` feature, this call may deadlock, or [panic](https://doc.rust-lang.org/std/sync/struct.RwLock.html#panics-1). /// Under the `sync` feature, this call may deadlock, or [panic](https://doc.rust-lang.org/std/sync/struct.RwLock.html#panics-1).
/// Otherwise, this call panics if the data is currently borrowed for write. /// Otherwise, this call panics if the data is currently borrowed for write.
#[inline] #[inline]
#[must_use]
pub fn read_lock<T: Any + Clone>(&self) -> Option<DynamicReadLock<T>> { pub fn read_lock<T: Any + Clone>(&self) -> Option<DynamicReadLock<T>> {
match self.0 { match self.0 {
#[cfg(not(feature = "no_closure"))] #[cfg(not(feature = "no_closure"))]
@ -1483,7 +1473,6 @@ impl Dynamic {
/// Under the `sync` feature, this call may deadlock, or [panic](https://doc.rust-lang.org/std/sync/struct.RwLock.html#panics-1). /// Under the `sync` feature, this call may deadlock, or [panic](https://doc.rust-lang.org/std/sync/struct.RwLock.html#panics-1).
/// Otherwise, this call panics if the data is currently borrowed for write. /// Otherwise, this call panics if the data is currently borrowed for write.
#[inline] #[inline]
#[must_use]
pub fn write_lock<T: Any + Clone>(&mut self) -> Option<DynamicWriteLock<T>> { pub fn write_lock<T: Any + Clone>(&mut self) -> Option<DynamicWriteLock<T>> {
match self.0 { match self.0 {
#[cfg(not(feature = "no_closure"))] #[cfg(not(feature = "no_closure"))]

View File

@ -15,6 +15,7 @@ use num_traits::float::FloatCore as Float;
/// ///
/// Not available under `no_float`. /// Not available under `no_float`.
#[derive(Clone, Copy, Eq, PartialEq, PartialOrd)] #[derive(Clone, Copy, Eq, PartialEq, PartialOrd)]
#[must_use]
pub struct FloatWrapper<F>(F); pub struct FloatWrapper<F>(F);
impl Hash for FloatWrapper<crate::FLOAT> { impl Hash for FloatWrapper<crate::FLOAT> {
@ -108,7 +109,6 @@ impl<F: Float> FloatWrapper<F> {
/// Create a new [`FloatWrapper`]. /// Create a new [`FloatWrapper`].
#[inline(always)] #[inline(always)]
#[must_use]
pub const fn new(value: F) -> Self { pub const fn new(value: F) -> Self {
Self(value) Self(value)
} }

View File

@ -24,7 +24,6 @@ pub const MAX_STRING_LEN: usize = 24;
/// _(internals)_ A cache for interned strings. /// _(internals)_ A cache for interned strings.
/// Exported under the `internals` feature only. /// Exported under the `internals` feature only.
#[derive(Clone)] #[derive(Clone)]
#[must_use]
pub struct StringsInterner { pub struct StringsInterner {
/// Cached strings. /// Cached strings.
cache: StraightHashMap<ImmutableString>, cache: StraightHashMap<ImmutableString>,
@ -34,6 +33,7 @@ pub struct StringsInterner {
impl Default for StringsInterner { impl Default for StringsInterner {
#[inline(always)] #[inline(always)]
#[must_use]
fn default() -> Self { fn default() -> Self {
Self::new() Self::new()
} }
@ -50,6 +50,7 @@ impl fmt::Debug for StringsInterner {
impl StringsInterner { impl StringsInterner {
/// Create a new [`StringsInterner`]. /// Create a new [`StringsInterner`].
#[inline(always)] #[inline(always)]
#[must_use]
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
cache: StraightHashMap::default(), cache: StraightHashMap::default(),

View File

@ -386,7 +386,7 @@ impl Scope<'_> {
#[inline(always)] #[inline(always)]
pub fn pop(&mut self) -> &mut Self { pub fn pop(&mut self) -> &mut Self {
self.names.pop().expect("`Scope` must not be empty"); self.names.pop().expect("`Scope` must not be empty");
self.values.pop().expect("`Scope` must not be empty"); let _ = self.values.pop().expect("`Scope` must not be empty");
self.aliases.pop().expect("`Scope` must not be empty"); self.aliases.pop().expect("`Scope` must not be empty");
self self
} }