Remove redundant std.
This commit is contained in:
parent
0f66c67f82
commit
8ff1f57900
@ -68,7 +68,7 @@ pub struct ScriptFnDef {
|
||||
/// Function doc-comments (if any).
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
#[cfg(feature = "metadata")]
|
||||
pub comments: StaticVec<std::string::String>,
|
||||
pub comments: StaticVec<String>,
|
||||
}
|
||||
|
||||
impl fmt::Display for ScriptFnDef {
|
||||
|
@ -1717,13 +1717,13 @@ impl From<&ImmutableString> for Dynamic {
|
||||
impl From<&crate::Identifier> for Dynamic {
|
||||
#[inline(always)]
|
||||
fn from(value: &crate::Identifier) -> Self {
|
||||
std::string::ToString::to_string(value).into()
|
||||
value.to_string().into()
|
||||
}
|
||||
}
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
impl<T: Variant + Clone> From<std::vec::Vec<T>> for Dynamic {
|
||||
impl<T: Variant + Clone> From<Vec<T>> for Dynamic {
|
||||
#[inline(always)]
|
||||
fn from(value: std::vec::Vec<T>) -> Self {
|
||||
fn from(value: Vec<T>) -> Self {
|
||||
Self(Union::Array(
|
||||
Box::new(value.into_iter().map(Dynamic::from).collect()),
|
||||
AccessMode::ReadWrite,
|
||||
|
@ -59,7 +59,7 @@ impl Engine {
|
||||
#[cfg(feature = "metadata")]
|
||||
let mut param_type_names: crate::StaticVec<_> = F::param_names()
|
||||
.iter()
|
||||
.map(|ty| std::format!("_: {}", self.map_type_name(ty)))
|
||||
.map(|ty| format!("_: {}", self.map_type_name(ty)))
|
||||
.collect();
|
||||
|
||||
#[cfg(feature = "metadata")]
|
||||
@ -119,7 +119,7 @@ impl Engine {
|
||||
#[cfg(feature = "metadata")]
|
||||
let param_type_names: crate::StaticVec<_> = F::param_names()
|
||||
.iter()
|
||||
.map(|ty| std::format!("_: {}", self.map_type_name(ty)))
|
||||
.map(|ty| format!("_: {}", self.map_type_name(ty)))
|
||||
.chain(std::iter::once(
|
||||
self.map_type_name(F::return_type_name()).into(),
|
||||
))
|
||||
@ -1172,7 +1172,7 @@ impl Engine {
|
||||
|
||||
let mut f = std::fs::File::open(path.clone()).map_err(|err| {
|
||||
EvalAltResult::ErrorSystem(
|
||||
std::format!("Cannot open script file '{}'", path.to_string_lossy()),
|
||||
format!("Cannot open script file '{}'", path.to_string_lossy()),
|
||||
err.into(),
|
||||
)
|
||||
})?;
|
||||
@ -1181,7 +1181,7 @@ impl Engine {
|
||||
|
||||
f.read_to_string(&mut contents).map_err(|err| {
|
||||
EvalAltResult::ErrorSystem(
|
||||
std::format!("Cannot read script file '{}'", path.to_string_lossy()),
|
||||
format!("Cannot read script file '{}'", path.to_string_lossy()),
|
||||
err.into(),
|
||||
)
|
||||
})?;
|
||||
@ -2010,16 +2010,13 @@ impl Engine {
|
||||
/// 2) Functions in registered sub-modules
|
||||
/// 3) Functions in packages (optional)
|
||||
#[cfg(feature = "metadata")]
|
||||
pub fn gen_fn_signatures(&self, include_packages: bool) -> std::vec::Vec<String> {
|
||||
let mut signatures: std::vec::Vec<_> = Default::default();
|
||||
pub fn gen_fn_signatures(&self, include_packages: bool) -> Vec<String> {
|
||||
let mut signatures: Vec<_> = Default::default();
|
||||
|
||||
signatures.extend(self.global_namespace.gen_fn_signatures());
|
||||
|
||||
self.global_sub_modules.iter().for_each(|(name, m)| {
|
||||
signatures.extend(
|
||||
m.gen_fn_signatures()
|
||||
.map(|f| std::format!("{}::{}", name, f)),
|
||||
)
|
||||
signatures.extend(m.gen_fn_signatures().map(|f| format!("{}::{}", name, f)))
|
||||
});
|
||||
|
||||
if include_packages {
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
use crate::dynamic::Variant;
|
||||
use crate::{Dynamic, StaticVec};
|
||||
use std::vec::Vec;
|
||||
|
||||
/// Trait that parses arguments to a function call.
|
||||
///
|
||||
|
@ -463,7 +463,7 @@ impl Engine {
|
||||
) -> RhaiResult {
|
||||
#[inline(always)]
|
||||
fn make_error(
|
||||
name: std::string::String,
|
||||
name: String,
|
||||
fn_def: &crate::ast::ScriptFnDef,
|
||||
state: &State,
|
||||
err: Box<EvalAltResult>,
|
||||
|
@ -72,7 +72,7 @@ impl FuncInfo {
|
||||
let mut sig = format!("{}(", self.name);
|
||||
|
||||
if !self.param_names.is_empty() {
|
||||
let mut params: std::vec::Vec<String> =
|
||||
let mut params: Vec<String> =
|
||||
self.param_names.iter().map(|s| s.as_str().into()).collect();
|
||||
let return_type = params.pop().unwrap_or_else(|| "()".into());
|
||||
sig.push_str(¶ms.join(", "));
|
||||
@ -200,7 +200,7 @@ impl fmt::Debug for Module {
|
||||
&self
|
||||
.functions
|
||||
.values()
|
||||
.map(|f| std::string::ToString::to_string(&f.func))
|
||||
.map(|f| f.func.to_string())
|
||||
.collect::<BTreeSet<_>>(),
|
||||
);
|
||||
}
|
||||
|
@ -4,9 +4,6 @@ use std::ops::Range;
|
||||
#[cfg(feature = "no_std")]
|
||||
use std::prelude::v1::*;
|
||||
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
use std::string::ToString;
|
||||
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
use num_traits::{CheckedAdd as Add, CheckedSub as Sub};
|
||||
|
||||
@ -209,8 +206,6 @@ def_package!(crate:BasicIteratorPackage:"Basic range iterators.", lib, {
|
||||
pub fn new(from: Decimal, to: Decimal, step: Decimal) -> Result<Self, Box<EvalAltResult>> {
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
if step.is_zero() {
|
||||
use std::string::ToString;
|
||||
|
||||
return EvalAltResult::ErrorInFunctionCall("range".to_string(), "".to_string(),
|
||||
Box::new(EvalAltResult::ErrorArithmetic("step value cannot be zero".to_string(), crate::Position::NONE)),
|
||||
crate::Position::NONE,
|
||||
|
@ -103,7 +103,7 @@ mod print_debug_functions {
|
||||
)]
|
||||
pub fn format_array(ctx: NativeCallContext, array: &mut Array) -> ImmutableString {
|
||||
let len = array.len();
|
||||
let mut result = std::string::String::with_capacity(len * 5 + 2);
|
||||
let mut result = String::with_capacity(len * 5 + 2);
|
||||
result.push_str("[");
|
||||
|
||||
array.iter_mut().enumerate().for_each(|(i, x)| {
|
||||
@ -130,7 +130,7 @@ mod print_debug_functions {
|
||||
)]
|
||||
pub fn format_map(ctx: NativeCallContext, map: &mut Map) -> ImmutableString {
|
||||
let len = map.len();
|
||||
let mut result = std::string::String::with_capacity(len * 5 + 3);
|
||||
let mut result = String::with_capacity(len * 5 + 3);
|
||||
result.push_str("#{");
|
||||
|
||||
map.iter_mut().enumerate().for_each(|(i, (k, v))| {
|
||||
|
@ -2516,7 +2516,7 @@ fn parse_stmt(
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
#[cfg(feature = "metadata")]
|
||||
let comments = {
|
||||
let mut comments: StaticVec<std::string::String> = Default::default();
|
||||
let mut comments: StaticVec<String> = Default::default();
|
||||
let mut comments_pos = Position::NONE;
|
||||
|
||||
// Handle doc-comments.
|
||||
@ -2771,7 +2771,7 @@ fn parse_fn(
|
||||
mut settings: ParseSettings,
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
#[cfg(feature = "metadata")]
|
||||
comments: StaticVec<std::string::String>,
|
||||
comments: StaticVec<String>,
|
||||
) -> Result<ScriptFnDef, ParseError> {
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
settings.ensure_level_within_max_limit(state.max_expr_depth)?;
|
||||
|
Loading…
Reference in New Issue
Block a user