Shut up clippy.

This commit is contained in:
Stephen Chung
2022-08-27 16:26:41 +08:00
parent d80184ba14
commit bf5d6ab35a
28 changed files with 313 additions and 205 deletions

View File

@@ -134,10 +134,7 @@ impl Expression<'_> {
Expr::CharConstant(x, ..) => reify!(*x => Option<T>),
Expr::StringConstant(x, ..) => reify!(x.clone() => Option<T>),
Expr::Variable(x, ..) => {
let x: ImmutableString = x.3.clone().into();
reify!(x => Option<T>)
}
Expr::Variable(x, ..) => reify!(x.3.clone() => Option<T>),
Expr::BoolConstant(x, ..) => reify!(*x => Option<T>),
Expr::Unit(..) => reify!(() => Option<T>),

View File

@@ -3,9 +3,8 @@
#![cfg(feature = "metadata")]
use crate::module::FuncInfo;
use crate::plugin::*;
use crate::tokenizer::{is_valid_function_name, Token};
use crate::{Engine, Module, Scope, INT};
use crate::{Engine, FnAccess, Module, Scope, INT};
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
@@ -117,19 +116,20 @@ impl Definitions<'_> {
}
/// Get the [`Engine`].
#[inline(always)]
pub fn engine(&self) -> &Engine {
#[must_use]
pub const fn engine(&self) -> &Engine {
self.engine
}
/// Get the [`Scope`].
#[inline(always)]
#[must_use]
pub fn scope(&self) -> Option<&Scope> {
pub const fn scope(&self) -> Option<&Scope> {
self.scope
}
/// Get the configuration.
#[inline(always)]
#[must_use]
pub(crate) fn config(&self) -> &DefinitionsConfig {
pub(crate) const fn config(&self) -> &DefinitionsConfig {
&self.config
}
}

View File

@@ -348,7 +348,7 @@ impl Engine {
#[inline(always)]
pub fn register_debugger(
&mut self,
init: impl Fn(&Engine) -> Dynamic + SendSync + 'static,
init: impl Fn(&Self) -> Dynamic + SendSync + 'static,
callback: impl Fn(
EvalContext,
crate::eval::DebuggerEvent,

View File

@@ -102,11 +102,8 @@ fn map_std_type_name(name: &str, shorthands: bool) -> &str {
};
}
if let Some(stripped) = name.strip_prefix("rhai::") {
map_std_type_name(stripped, shorthands)
} else {
name
}
name.strip_prefix("rhai::")
.map_or(name, |s| map_std_type_name(s, shorthands))
}
impl Engine {