mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
refactor(cli,core,ext,rt): remove some unnecessary clone
or malloc
(#17274)
This commit is contained in:
parent
4e6b78cb43
commit
896dd56b7a
24 changed files with 86 additions and 72 deletions
|
@ -58,7 +58,7 @@ pub fn check(
|
|||
roots: &[(ModuleSpecifier, ModuleKind)],
|
||||
graph_data: Arc<RwLock<GraphData>>,
|
||||
cache: &TypeCheckCache,
|
||||
npm_resolver: NpmPackageResolver,
|
||||
npm_resolver: &NpmPackageResolver,
|
||||
options: CheckOptions,
|
||||
) -> Result<CheckResult, AnyError> {
|
||||
let check_js = options.ts_config.get_check_js();
|
||||
|
|
|
@ -183,5 +183,5 @@ pub async fn run(flags: Flags, repl_flags: ReplFlags) -> Result<i32, AnyError> {
|
|||
}
|
||||
}
|
||||
|
||||
Ok(repl_session.worker.get_exit_code())
|
||||
Ok(repl_session.worker.exit_code())
|
||||
}
|
||||
|
|
8
cli/tools/vendor/test.rs
vendored
8
cli/tools/vendor/test.rs
vendored
|
@ -242,7 +242,7 @@ impl VendorTestBuilder {
|
|||
let import_map = files.remove(&output_dir.join("import_map.json"));
|
||||
let mut files = files
|
||||
.iter()
|
||||
.map(|(path, text)| (path_to_string(path), text.clone()))
|
||||
.map(|(path, text)| (path_to_string(path), text.to_string()))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
files.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
|
@ -293,7 +293,11 @@ fn make_path(text: &str) -> PathBuf {
|
|||
}
|
||||
}
|
||||
|
||||
fn path_to_string(path: &Path) -> String {
|
||||
fn path_to_string<P>(path: P) -> String
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
let path = path.as_ref();
|
||||
// inverse of the function above
|
||||
let path = path.to_string_lossy();
|
||||
if cfg!(windows) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue