Satisfy clippy.

This commit is contained in:
Stephen Chung
2022-12-22 17:34:58 +08:00
parent bbd94dbffb
commit 80ccd75514
40 changed files with 346 additions and 196 deletions

View File

@@ -254,12 +254,13 @@ impl Engine {
})?;
let bit_value = (*value & (1 << bit)) != 0;
#[allow(clippy::cast_possible_truncation)]
let bit = bit as u8;
Ok(Target::Bit {
source: target,
value: bit_value.into(),
#[allow(clippy::cast_possible_truncation)]
bit: bit as u8,
bit,
})
}

View File

@@ -385,13 +385,11 @@ impl Debugger {
}
/// Get the custom state.
#[inline(always)]
#[must_use]
pub const fn state(&self) -> &Dynamic {
&self.state
}
/// Get a mutable reference to the custom state.
#[inline(always)]
#[must_use]
pub fn state_mut(&mut self) -> &mut Dynamic {
&mut self.state
}

View File

@@ -72,13 +72,11 @@ impl<'a, 's, 'ps, 'g, 'c, 't> EvalContext<'a, 's, 'ps, 'g, 'c, 't> {
}
/// Custom state kept in a [`Dynamic`].
#[inline(always)]
#[must_use]
pub const fn tag(&self) -> &Dynamic {
&self.global.tag
}
/// Mutable reference to the custom state kept in a [`Dynamic`].
#[inline(always)]
#[must_use]
pub fn tag_mut(&mut self) -> &mut Dynamic {
&mut self.global.tag
}

View File

@@ -317,6 +317,7 @@ impl GlobalRuntimeState {
///
/// Panics if the debugging interface is not set.
#[cfg(feature = "debugging")]
#[must_use]
pub fn debugger(&self) -> &super::Debugger {
self.debugger.as_ref().unwrap()
}
@@ -326,6 +327,7 @@ impl GlobalRuntimeState {
///
/// Panics if the debugging interface is not set.
#[cfg(feature = "debugging")]
#[must_use]
pub fn debugger_mut(&mut self) -> &mut super::Debugger {
self.debugger.as_deref_mut().unwrap()
}

View File

@@ -235,7 +235,6 @@ impl<'a> Target<'a> {
/// Get the source [`Dynamic`] of the [`Target`].
#[allow(dead_code)]
#[inline]
#[must_use]
pub fn source(&self) -> &Dynamic {
match self {
Self::RefMut(r) => r,
@@ -399,7 +398,6 @@ impl Deref for Target<'_> {
impl AsRef<Dynamic> for Target<'_> {
#[inline(always)]
#[must_use]
fn as_ref(&self) -> &Dynamic {
self
}
@@ -407,7 +405,6 @@ impl AsRef<Dynamic> for Target<'_> {
impl Borrow<Dynamic> for Target<'_> {
#[inline(always)]
#[must_use]
fn borrow(&self) -> &Dynamic {
self
}
@@ -432,7 +429,6 @@ impl DerefMut for Target<'_> {
impl AsMut<Dynamic> for Target<'_> {
#[inline(always)]
#[must_use]
fn as_mut(&mut self) -> &mut Dynamic {
self
}