diff options
author | Yiyu Lin <linyiyu1992@gmail.com> | 2023-01-06 03:29:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-05 14:29:50 -0500 |
commit | 896dd56b7af06fea6604a5596a6ffd17e7e52e6e (patch) | |
tree | 92d3c94afe4923f1d1faccc8034a03f78b807ade /ext | |
parent | 4e6b78cb43ece70df28281c8033b51366b110acf (diff) |
refactor(cli,core,ext,rt): remove some unnecessary `clone` or `malloc` (#17274)
Diffstat (limited to 'ext')
-rw-r--r-- | ext/napi/lib.rs | 2 | ||||
-rw-r--r-- | ext/webstorage/lib.rs | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/ext/napi/lib.rs b/ext/napi/lib.rs index 24d7c7c11..b281fb9f2 100644 --- a/ext/napi/lib.rs +++ b/ext/napi/lib.rs @@ -529,7 +529,7 @@ where let exports = v8::Object::new(scope); let mut env_shared = EnvShared::new(napi_wrap); - let cstr = CString::new(path.clone()).unwrap(); + let cstr = CString::new(&*path).unwrap(); env_shared.filename = cstr.as_ptr(); std::mem::forget(cstr); diff --git a/ext/webstorage/lib.rs b/ext/webstorage/lib.rs index 736bea4b5..5425edc04 100644 --- a/ext/webstorage/lib.rs +++ b/ext/webstorage/lib.rs @@ -2,6 +2,9 @@ // NOTE to all: use **cached** prepared statements when interfacing with SQLite. +use std::fmt; +use std::path::PathBuf; + use deno_core::error::AnyError; use deno_core::include_js_files; use deno_core::op; @@ -10,8 +13,6 @@ use deno_core::OpState; use rusqlite::params; use rusqlite::Connection; use rusqlite::OptionalExtension; -use std::fmt; -use std::path::PathBuf; pub use rusqlite; |