mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
chore: use Rust 1.65.0 (#16688)
This commit is contained in:
parent
483c10c94b
commit
238590aa9f
48 changed files with 119 additions and 130 deletions
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
|
@ -157,15 +157,15 @@ jobs:
|
|||
# to complete.
|
||||
sudo apt-get remove --purge -y man-db
|
||||
|
||||
# Install clang-14, lld-14, and debootstrap.
|
||||
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main" |
|
||||
sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-focal-14.list
|
||||
# Install clang-15, lld-15, and debootstrap.
|
||||
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" |
|
||||
sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-focal-15.list
|
||||
curl https://apt.llvm.org/llvm-snapshot.gpg.key |
|
||||
gpg --dearmor |
|
||||
sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg
|
||||
sudo apt-get update
|
||||
sudo apt-get install --no-install-recommends debootstrap \
|
||||
clang-14 lld-14
|
||||
clang-15 lld-15
|
||||
|
||||
# Create ubuntu-16.04 sysroot environment, which is used to avoid
|
||||
# depending on a very recent version of glibc.
|
||||
|
@ -190,8 +190,8 @@ jobs:
|
|||
CARGO_PROFILE_RELEASE_LTO=false
|
||||
RUSTFLAGS<<__1
|
||||
-C linker-plugin-lto=true
|
||||
-C linker=clang-14
|
||||
-C link-arg=-fuse-ld=lld-14
|
||||
-C linker=clang-15
|
||||
-C link-arg=-fuse-ld=lld-15
|
||||
-C link-arg=--sysroot=/sysroot
|
||||
-C link-arg=-Wl,--allow-shlib-undefined
|
||||
-C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
|
||||
|
@ -200,15 +200,15 @@ jobs:
|
|||
__1
|
||||
RUSTDOCFLAGS<<__1
|
||||
-C linker-plugin-lto=true
|
||||
-C linker=clang-14
|
||||
-C link-arg=-fuse-ld=lld-14
|
||||
-C linker=clang-15
|
||||
-C link-arg=-fuse-ld=lld-15
|
||||
-C link-arg=--sysroot=/sysroot
|
||||
-C link-arg=-Wl,--allow-shlib-undefined
|
||||
-C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
|
||||
-C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
|
||||
${{ env.RUSTFLAGS }}
|
||||
__1
|
||||
CC=clang-14
|
||||
CC=clang-15
|
||||
CFLAGS=-flto=thin --sysroot=/sysroot
|
||||
__0
|
||||
|
||||
|
|
|
@ -637,7 +637,7 @@ fn clap_root(version: &str) -> Command {
|
|||
.help("Set log level")
|
||||
.hide(true)
|
||||
.takes_value(true)
|
||||
.possible_values(&["debug", "info"])
|
||||
.possible_values(["debug", "info"])
|
||||
.global(true),
|
||||
)
|
||||
.arg(
|
||||
|
@ -811,7 +811,7 @@ fn compile_subcommand<'a>() -> Command<'a> {
|
|||
.long("target")
|
||||
.help("Target OS architecture")
|
||||
.takes_value(true)
|
||||
.possible_values(&[
|
||||
.possible_values([
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-pc-windows-msvc",
|
||||
"x86_64-apple-darwin",
|
||||
|
@ -848,7 +848,7 @@ fn completions_subcommand<'a>() -> Command<'a> {
|
|||
.disable_help_subcommand(true)
|
||||
.arg(
|
||||
Arg::new("shell")
|
||||
.possible_values(&["bash", "fish", "powershell", "zsh", "fig"])
|
||||
.possible_values(["bash", "fish", "powershell", "zsh", "fig"])
|
||||
.required(true),
|
||||
)
|
||||
.about("Generate shell completions")
|
||||
|
@ -1049,7 +1049,7 @@ This command has implicit access to all permissions (--allow-all).",
|
|||
.help("Set standard input (stdin) content type")
|
||||
.takes_value(true)
|
||||
.default_value("js")
|
||||
.possible_values(&["ts", "tsx", "js", "jsx"]),
|
||||
.possible_values(["ts", "tsx", "js", "jsx"]),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("print")
|
||||
|
@ -1106,7 +1106,7 @@ Ignore formatting a file by adding an ignore comment at the top of the file:
|
|||
.help("Set standard input (stdin) content type")
|
||||
.takes_value(true)
|
||||
.default_value("ts")
|
||||
.possible_values(&["ts", "tsx", "js", "jsx", "md", "json", "jsonc"]),
|
||||
.possible_values(["ts", "tsx", "js", "jsx", "md", "json", "jsonc"]),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("ignore")
|
||||
|
@ -1165,7 +1165,7 @@ Ignore formatting a file by adding an ignore comment at the top of the file:
|
|||
Arg::new("options-prose-wrap")
|
||||
.long("options-prose-wrap")
|
||||
.takes_value(true)
|
||||
.possible_values(&["always", "never", "preserve"])
|
||||
.possible_values(["always", "never", "preserve"])
|
||||
.help("Define how prose should be wrapped. Defaults to always."),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -343,7 +343,7 @@ fn run_max_mem_benchmark(deno_exe: &Path) -> Result<HashMap<String, i64>> {
|
|||
|
||||
for (name, args, return_code) in EXEC_TIME_BENCHMARKS {
|
||||
let proc = Command::new("time")
|
||||
.args(&["-v", deno_exe.to_str().unwrap()])
|
||||
.args(["-v", deno_exe.to_str().unwrap()])
|
||||
.args(args.iter())
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::piped())
|
||||
|
@ -501,7 +501,7 @@ async fn main() -> Result<()> {
|
|||
let mut file = secure_tempfile::NamedTempFile::new()?;
|
||||
|
||||
let exit_status = Command::new("strace")
|
||||
.args(&[
|
||||
.args([
|
||||
"-c",
|
||||
"-f",
|
||||
"-o",
|
||||
|
|
|
@ -39,7 +39,7 @@ fn create_snapshot(
|
|||
}
|
||||
|
||||
let snapshot = js_runtime.snapshot();
|
||||
let snapshot_slice: &[u8] = &*snapshot;
|
||||
let snapshot_slice: &[u8] = &snapshot;
|
||||
println!("Snapshot size: {}", snapshot_slice.len());
|
||||
|
||||
let compressed_snapshot_with_size = {
|
||||
|
@ -64,7 +64,7 @@ fn create_snapshot(
|
|||
compressed_snapshot_with_size.len()
|
||||
);
|
||||
|
||||
std::fs::write(&snapshot_path, compressed_snapshot_with_size).unwrap();
|
||||
std::fs::write(snapshot_path, compressed_snapshot_with_size).unwrap();
|
||||
println!("Snapshot written to: {} ", snapshot_path.display());
|
||||
}
|
||||
|
||||
|
|
2
cli/cache/disk_cache.rs
vendored
2
cli/cache/disk_cache.rs
vendored
|
@ -40,7 +40,7 @@ impl DiskCache {
|
|||
if path.is_dir() {
|
||||
return Ok(());
|
||||
}
|
||||
fs::create_dir_all(&path).map_err(|e| {
|
||||
fs::create_dir_all(path).map_err(|e| {
|
||||
io::Error::new(e.kind(), format!(
|
||||
"Could not create TypeScript compiler cache location: {:?}\nCheck the permission of the directory.",
|
||||
path
|
||||
|
|
|
@ -333,9 +333,9 @@ pub async fn remove_dir_all_if_exists(path: &Path) -> std::io::Result<()> {
|
|||
///
|
||||
/// Note: Does not handle symlinks.
|
||||
pub fn copy_dir_recursive(from: &Path, to: &Path) -> Result<(), AnyError> {
|
||||
std::fs::create_dir_all(&to)
|
||||
std::fs::create_dir_all(to)
|
||||
.with_context(|| format!("Creating {}", to.display()))?;
|
||||
let read_dir = std::fs::read_dir(&from)
|
||||
let read_dir = std::fs::read_dir(from)
|
||||
.with_context(|| format!("Reading {}", from.display()))?;
|
||||
|
||||
for entry in read_dir {
|
||||
|
@ -362,9 +362,9 @@ pub fn copy_dir_recursive(from: &Path, to: &Path) -> Result<(), AnyError> {
|
|||
///
|
||||
/// Note: Does not handle symlinks.
|
||||
pub fn hard_link_dir_recursive(from: &Path, to: &Path) -> Result<(), AnyError> {
|
||||
std::fs::create_dir_all(&to)
|
||||
std::fs::create_dir_all(to)
|
||||
.with_context(|| format!("Creating {}", to.display()))?;
|
||||
let read_dir = std::fs::read_dir(&from)
|
||||
let read_dir = std::fs::read_dir(from)
|
||||
.with_context(|| format!("Reading {}", from.display()))?;
|
||||
|
||||
for entry in read_dir {
|
||||
|
@ -451,7 +451,7 @@ pub fn symlink_dir(oldpath: &Path, newpath: &Path) -> Result<(), AnyError> {
|
|||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::symlink;
|
||||
symlink(&oldpath, &newpath).map_err(err_mapper)?;
|
||||
symlink(oldpath, newpath).map_err(err_mapper)?;
|
||||
}
|
||||
#[cfg(not(unix))]
|
||||
{
|
||||
|
|
|
@ -123,7 +123,7 @@ impl HttpCache {
|
|||
if path.is_dir() {
|
||||
return Ok(());
|
||||
}
|
||||
fs::create_dir_all(&path).map_err(|e| {
|
||||
fs::create_dir_all(path).map_err(|e| {
|
||||
io::Error::new(
|
||||
e.kind(),
|
||||
format!(
|
||||
|
|
|
@ -469,7 +469,7 @@ fn get_workspace_completions(
|
|||
specifier_strings
|
||||
.into_iter()
|
||||
.filter_map(|label| {
|
||||
if label.starts_with(¤t) {
|
||||
if label.starts_with(current) {
|
||||
let detail = Some(
|
||||
if label.starts_with("http:") || label.starts_with("https:") {
|
||||
"(remote)".to_string()
|
||||
|
|
|
@ -877,7 +877,7 @@ mod tests {
|
|||
assert!(result.is_ok(), "Could not parse path: \"{}\"", path);
|
||||
let (re, _) = result.unwrap();
|
||||
for (fixture, expected) in fixtures {
|
||||
let result = re.find(*fixture);
|
||||
let result = re.find(fixture);
|
||||
assert!(
|
||||
result.is_ok(),
|
||||
"Find failure for path \"{}\" and fixture \"{}\"",
|
||||
|
|
|
@ -772,7 +772,7 @@ async fn test_command(
|
|||
test_flags: TestFlags,
|
||||
) -> Result<i32, AnyError> {
|
||||
if let Some(ref coverage_dir) = flags.coverage_dir {
|
||||
std::fs::create_dir_all(&coverage_dir)?;
|
||||
std::fs::create_dir_all(coverage_dir)?;
|
||||
env::set_var(
|
||||
"DENO_UNSTABLE_COVERAGE_DIR",
|
||||
PathBuf::from(coverage_dir).canonicalize()?,
|
||||
|
@ -994,7 +994,7 @@ pub fn main() {
|
|||
Err(err) => unwrap_or_exit(Err(AnyError::from(err))),
|
||||
};
|
||||
if !flags.v8_flags.is_empty() {
|
||||
init_v8_flags(&*flags.v8_flags);
|
||||
init_v8_flags(&flags.v8_flags);
|
||||
}
|
||||
|
||||
logger::init(flags.log_level);
|
||||
|
|
|
@ -140,7 +140,7 @@ impl CliModuleLoader {
|
|||
let file_path = specifier.to_file_path().unwrap();
|
||||
let code = std::fs::read_to_string(&file_path).with_context(|| {
|
||||
let mut msg = "Unable to load ".to_string();
|
||||
msg.push_str(&*file_path.to_string_lossy());
|
||||
msg.push_str(&file_path.to_string_lossy());
|
||||
if let Some(referrer) = &maybe_referrer {
|
||||
msg.push_str(" imported from ");
|
||||
msg.push_str(referrer.as_str());
|
||||
|
|
|
@ -78,7 +78,7 @@ pub fn with_folder_sync_lock(
|
|||
match inner(output_folder, action) {
|
||||
Ok(()) => Ok(()),
|
||||
Err(err) => {
|
||||
if let Err(remove_err) = fs::remove_dir_all(&output_folder) {
|
||||
if let Err(remove_err) = fs::remove_dir_all(output_folder) {
|
||||
if remove_err.kind() != std::io::ErrorKind::NotFound {
|
||||
bail!(
|
||||
concat!(
|
||||
|
@ -156,7 +156,7 @@ impl ReadonlyNpmCache {
|
|||
root_dir: &Path,
|
||||
) -> Result<PathBuf, AnyError> {
|
||||
if !root_dir.exists() {
|
||||
std::fs::create_dir_all(&root_dir)
|
||||
std::fs::create_dir_all(root_dir)
|
||||
.with_context(|| format!("Error creating {}", root_dir.display()))?;
|
||||
}
|
||||
Ok(crate::fs_util::canonicalize_path(root_dir)?)
|
||||
|
|
|
@ -397,7 +397,7 @@ impl RealNpmRegistryApiInner {
|
|||
) -> Result<(), AnyError> {
|
||||
let file_cache_path = self.get_package_file_cache_path(name);
|
||||
let file_text = serde_json::to_string(&package_info)?;
|
||||
std::fs::create_dir_all(&file_cache_path.parent().unwrap())?;
|
||||
std::fs::create_dir_all(file_cache_path.parent().unwrap())?;
|
||||
fs_util::atomic_write_file(&file_cache_path, file_text, CACHE_PERM)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -245,7 +245,7 @@ pub fn resolve_npm_package_reqs(graph: &ModuleGraph) -> Vec<NpmPackageReq> {
|
|||
for specifier in &specifiers {
|
||||
if let Ok(npm_ref) = NpmPackageReference::from_specifier(specifier) {
|
||||
leaf.reqs.insert(npm_ref.req);
|
||||
} else if !specifier.as_str().starts_with(&parent_specifier.as_str()) {
|
||||
} else if !specifier.as_str().starts_with(parent_specifier.as_str()) {
|
||||
leaf
|
||||
.dependencies
|
||||
.insert(get_folder_path_specifier(specifier));
|
||||
|
|
|
@ -104,7 +104,7 @@ pub fn ensure_registry_read_permission(
|
|||
path: &Path,
|
||||
) -> Result<(), AnyError> {
|
||||
// allow reading if it's in the node_modules
|
||||
if path.starts_with(®istry_path)
|
||||
if path.starts_with(registry_path)
|
||||
&& path
|
||||
.components()
|
||||
.all(|c| !matches!(c, std::path::Component::ParentDir))
|
||||
|
|
|
@ -110,8 +110,8 @@ fn extract_tarball(data: &[u8], output_folder: &Path) -> Result<(), AnyError> {
|
|||
absolute_path.parent().unwrap()
|
||||
};
|
||||
if created_dirs.insert(dir_path.to_path_buf()) {
|
||||
fs::create_dir_all(&dir_path)?;
|
||||
let canonicalized_dir = fs::canonicalize(&dir_path)?;
|
||||
fs::create_dir_all(dir_path)?;
|
||||
let canonicalized_dir = fs::canonicalize(dir_path)?;
|
||||
if !canonicalized_dir.starts_with(&output_folder) {
|
||||
bail!(
|
||||
"Extracted directory '{}' of npm tarball was not in output directory.",
|
||||
|
|
|
@ -15,7 +15,7 @@ fn info_with_compiled_source() {
|
|||
.env("DENO_DIR", t.path())
|
||||
.current_dir(util::testdata_path())
|
||||
.arg("cache")
|
||||
.arg(&module_path)
|
||||
.arg(module_path)
|
||||
.spawn()
|
||||
.unwrap();
|
||||
let status = deno.wait().unwrap();
|
||||
|
@ -26,7 +26,7 @@ fn info_with_compiled_source() {
|
|||
.env("NO_COLOR", "1")
|
||||
.current_dir(util::testdata_path())
|
||||
.arg("info")
|
||||
.arg(&module_path)
|
||||
.arg(module_path)
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
|
|
|
@ -6077,7 +6077,7 @@ Deno.test({
|
|||
}
|
||||
});
|
||||
"#;
|
||||
fs::write(&module_path, &contents).unwrap();
|
||||
fs::write(&module_path, contents).unwrap();
|
||||
fs::write(temp_dir.path().join("./deno.jsonc"), r#"{}"#).unwrap();
|
||||
|
||||
params.root_uri = Some(root_specifier);
|
||||
|
|
|
@ -1703,8 +1703,7 @@ fn exec_path() {
|
|||
.unwrap();
|
||||
assert!(output.status.success());
|
||||
let stdout_str = std::str::from_utf8(&output.stdout).unwrap().trim();
|
||||
let actual =
|
||||
std::fs::canonicalize(&std::path::Path::new(stdout_str)).unwrap();
|
||||
let actual = std::fs::canonicalize(std::path::Path::new(stdout_str)).unwrap();
|
||||
let expected = std::fs::canonicalize(util::deno_exe_path()).unwrap();
|
||||
assert_eq!(expected, actual);
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ fn upgrade_with_out_in_tmpdir() {
|
|||
.arg("--version")
|
||||
.arg("1.11.5")
|
||||
.arg("--output")
|
||||
.arg(&new_exe_path.to_str().unwrap())
|
||||
.arg(new_exe_path.to_str().unwrap())
|
||||
.spawn()
|
||||
.unwrap()
|
||||
.wait()
|
||||
|
|
|
@ -262,7 +262,7 @@ fn existing_import_map_no_remote() {
|
|||
let import_map_filename = "imports2.json";
|
||||
let import_map_text =
|
||||
r#"{ "imports": { "http://localhost:4545/vendor/": "./logger/" } }"#;
|
||||
t.write(import_map_filename, &import_map_text);
|
||||
t.write(import_map_filename, import_map_text);
|
||||
t.create_dir_all("logger");
|
||||
t.write("logger/logger.ts", "export class Logger {}");
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ fn lint_all_files_on_each_change_test() {
|
|||
let mut child = util::deno_cmd()
|
||||
.current_dir(util::testdata_path())
|
||||
.arg("lint")
|
||||
.arg(&t.path())
|
||||
.arg(t.path())
|
||||
.arg("--watch")
|
||||
.arg("--unstable")
|
||||
.stdout(std::process::Stdio::piped())
|
||||
|
@ -349,7 +349,7 @@ fn fmt_check_all_files_on_each_change_test() {
|
|||
let mut child = util::deno_cmd()
|
||||
.current_dir(&fmt_testdata_path)
|
||||
.arg("fmt")
|
||||
.arg(&t.path())
|
||||
.arg(t.path())
|
||||
.arg("--watch")
|
||||
.arg("--check")
|
||||
.arg("--unstable")
|
||||
|
@ -832,7 +832,7 @@ fn test_watch() {
|
|||
.arg("--watch")
|
||||
.arg("--unstable")
|
||||
.arg("--no-check")
|
||||
.arg(&t.path())
|
||||
.arg(t.path())
|
||||
.env("NO_COLOR", "1")
|
||||
.stdout(std::process::Stdio::piped())
|
||||
.stderr(std::process::Stdio::piped())
|
||||
|
@ -973,7 +973,7 @@ fn test_watch_doc() {
|
|||
.arg("--watch")
|
||||
.arg("--doc")
|
||||
.arg("--unstable")
|
||||
.arg(&t.path())
|
||||
.arg(t.path())
|
||||
.env("NO_COLOR", "1")
|
||||
.stdout(std::process::Stdio::piped())
|
||||
.stderr(std::process::Stdio::piped())
|
||||
|
|
|
@ -210,7 +210,7 @@ impl BenchReporter for ConsoleReporter {
|
|||
println!();
|
||||
}
|
||||
|
||||
if None == self.group || group != self.group.as_ref().unwrap() {
|
||||
if self.group.is_none() || group != self.group.as_ref().unwrap() {
|
||||
self.report_group_summary();
|
||||
}
|
||||
|
||||
|
|
|
@ -126,8 +126,7 @@ pub fn merge_functions(
|
|||
trees.push(tree);
|
||||
}
|
||||
}
|
||||
let merged =
|
||||
RangeTree::normalize(&rta, merge_range_trees(&rta, trees).unwrap());
|
||||
let merged = RangeTree::normalize(merge_range_trees(&rta, trees).unwrap());
|
||||
let ranges = merged.to_ranges();
|
||||
let is_block_coverage: bool = !(ranges.len() == 1 && ranges[0].count == 0);
|
||||
|
||||
|
|
|
@ -71,10 +71,7 @@ impl<'rt> RangeTree<'rt> {
|
|||
(rta.alloc(left), rta.alloc(right))
|
||||
}
|
||||
|
||||
pub fn normalize<'a>(
|
||||
rta: &'a RangeTreeArena<'a>,
|
||||
tree: &'a mut RangeTree<'a>,
|
||||
) -> &'a mut RangeTree<'a> {
|
||||
pub fn normalize<'a>(tree: &'a mut RangeTree<'a>) -> &'a mut RangeTree<'a> {
|
||||
tree.children = {
|
||||
let mut children: Vec<&'a mut RangeTree<'a>> = Vec::new();
|
||||
let mut chain: Vec<&'a mut RangeTree<'a>> = Vec::new();
|
||||
|
@ -96,7 +93,7 @@ impl<'rt> RangeTree<'rt> {
|
|||
head.children.push(sub_child);
|
||||
}
|
||||
}
|
||||
children.push(RangeTree::normalize(rta, head));
|
||||
children.push(RangeTree::normalize(head));
|
||||
}
|
||||
chain.push(child)
|
||||
}
|
||||
|
@ -110,7 +107,7 @@ impl<'rt> RangeTree<'rt> {
|
|||
head.children.push(sub_child);
|
||||
}
|
||||
}
|
||||
children.push(RangeTree::normalize(rta, head));
|
||||
children.push(RangeTree::normalize(head));
|
||||
}
|
||||
|
||||
if children.len() == 1
|
||||
|
|
|
@ -635,7 +635,7 @@ struct FileContents {
|
|||
}
|
||||
|
||||
fn read_file_contents(file_path: &Path) -> Result<FileContents, AnyError> {
|
||||
let file_bytes = fs::read(&file_path)
|
||||
let file_bytes = fs::read(file_path)
|
||||
.with_context(|| format!("Error reading {}", file_path.display()))?;
|
||||
let charset = text_encoding::detect_charset(&file_bytes);
|
||||
let file_text = text_encoding::convert_to_utf8(&file_bytes, charset)?;
|
||||
|
|
|
@ -85,9 +85,9 @@ async fn download_base_binary(
|
|||
std::process::exit(1)
|
||||
};
|
||||
|
||||
std::fs::create_dir_all(&output_directory)?;
|
||||
std::fs::create_dir_all(output_directory)?;
|
||||
let output_path = output_directory.join(binary_path_suffix);
|
||||
std::fs::create_dir_all(&output_path.parent().unwrap())?;
|
||||
std::fs::create_dir_all(output_path.parent().unwrap())?;
|
||||
tokio::fs::write(output_path, binary_content).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -742,9 +742,7 @@ fn extract_files_from_regex_blocks(
|
|||
let files = blocks_regex
|
||||
.captures_iter(source)
|
||||
.filter_map(|block| {
|
||||
if block.get(1) == None {
|
||||
return None;
|
||||
}
|
||||
block.get(1)?;
|
||||
|
||||
let maybe_attributes: Option<Vec<_>> = block
|
||||
.get(1)
|
||||
|
|
2
cli/tools/vendor/build.rs
vendored
2
cli/tools/vendor/build.rs
vendored
|
@ -502,7 +502,7 @@ mod test {
|
|||
let output = builder
|
||||
.with_loader(|loader| {
|
||||
loader
|
||||
.add("/mod.ts", &mod_file_text)
|
||||
.add("/mod.ts", mod_file_text)
|
||||
.add("https://localhost/mod.ts", "export class Example {}");
|
||||
})
|
||||
.build()
|
||||
|
|
4
cli/tools/vendor/mod.rs
vendored
4
cli/tools/vendor/mod.rs
vendored
|
@ -113,7 +113,7 @@ fn validate_options(
|
|||
.and_then(|p| fs_util::canonicalize_path(&p).ok())
|
||||
{
|
||||
// make the output directory in order to canonicalize it for the check below
|
||||
std::fs::create_dir_all(&output_dir)?;
|
||||
std::fs::create_dir_all(output_dir)?;
|
||||
let output_dir =
|
||||
fs_util::canonicalize_path(output_dir).with_context(|| {
|
||||
format!("Failed to canonicalize: {}", output_dir.display())
|
||||
|
@ -248,7 +248,7 @@ fn update_config_text(
|
|||
}
|
||||
|
||||
fn is_dir_empty(dir_path: &Path) -> Result<bool, AnyError> {
|
||||
match std::fs::read_dir(&dir_path) {
|
||||
match std::fs::read_dir(dir_path) {
|
||||
Ok(mut dir) => Ok(dir.next().is_none()),
|
||||
Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(true),
|
||||
Err(err) => {
|
||||
|
|
|
@ -80,7 +80,7 @@ pub static COMPILER_SNAPSHOT: Lazy<Box<[u8]>> = Lazy::new(
|
|||
);
|
||||
|
||||
pub fn compiler_snapshot() -> Snapshot {
|
||||
Snapshot::Static(&*COMPILER_SNAPSHOT)
|
||||
Snapshot::Static(&COMPILER_SNAPSHOT)
|
||||
}
|
||||
|
||||
macro_rules! inc {
|
||||
|
|
|
@ -220,13 +220,13 @@ impl<T> Deref for RcRef<T> {
|
|||
|
||||
impl<T> Borrow<T> for RcRef<T> {
|
||||
fn borrow(&self) -> &T {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> AsRef<T> for RcRef<T> {
|
||||
fn as_ref(&self) -> &T {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -478,13 +478,13 @@ mod internal {
|
|||
|
||||
impl<T, M: BorrowModeTrait> Borrow<T> for AsyncBorrowImpl<T, M> {
|
||||
fn borrow(&self) -> &T {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, M: BorrowModeTrait> AsRef<T> for AsyncBorrowImpl<T, M> {
|
||||
fn as_ref(&self) -> &T {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,13 +500,13 @@ mod internal {
|
|||
|
||||
impl<T> BorrowMut<T> for AsyncBorrowImpl<T, Exclusive> {
|
||||
fn borrow_mut(&mut self) -> &mut T {
|
||||
&mut **self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> AsMut<T> for AsyncBorrowImpl<T, Exclusive> {
|
||||
fn as_mut(&mut self) -> &mut T {
|
||||
&mut **self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ impl JsError {
|
|||
serde_v8::from_v8(scope, exception.into()).unwrap_or_default();
|
||||
// Get the message by formatting error.name and error.message.
|
||||
let name = e.name.clone().unwrap_or_else(|| "Error".to_string());
|
||||
let message_prop = e.message.clone().unwrap_or_else(|| "".to_string());
|
||||
let message_prop = e.message.clone().unwrap_or_default();
|
||||
let exception_message = exception_message.unwrap_or_else(|| {
|
||||
if !name.is_empty() && !message_prop.is_empty() {
|
||||
format!("Uncaught {}: {}", name, message_prop)
|
||||
|
|
|
@ -131,7 +131,7 @@ fn create_js_runtime() -> JsRuntime {
|
|||
fn op_listen(state: &mut OpState) -> Result<ResourceId, Error> {
|
||||
log::debug!("listen");
|
||||
let addr = "127.0.0.1:4570".parse::<SocketAddr>().unwrap();
|
||||
let std_listener = std::net::TcpListener::bind(&addr)?;
|
||||
let std_listener = std::net::TcpListener::bind(addr)?;
|
||||
std_listener.set_nonblocking(true)?;
|
||||
let listener = TcpListener::try_from(std_listener)?;
|
||||
let rid = state.resource_table.add(listener);
|
||||
|
|
|
@ -2888,7 +2888,7 @@ pub mod tests {
|
|||
..Default::default()
|
||||
});
|
||||
runtime.execute_script("a.js", "a = 1 + 2").unwrap();
|
||||
let snap: &[u8] = &*runtime.snapshot();
|
||||
let snap: &[u8] = &runtime.snapshot();
|
||||
Vec::from(snap).into_boxed_slice()
|
||||
};
|
||||
|
||||
|
@ -4051,7 +4051,7 @@ Deno.core.ops.op_async_serialize_object_with_numbers_as_keys({
|
|||
will_snapshot: true,
|
||||
..Default::default()
|
||||
});
|
||||
let snap: &[u8] = &*runtime.snapshot();
|
||||
let snap: &[u8] = &runtime.snapshot();
|
||||
Vec::from(snap).into_boxed_slice()
|
||||
};
|
||||
|
||||
|
|
|
@ -198,14 +198,14 @@ pub async fn op_crypto_sign_key(
|
|||
|
||||
let signature = match algorithm {
|
||||
Algorithm::RsassaPkcs1v15 => {
|
||||
let private_key = RsaPrivateKey::from_pkcs1_der(&*args.key.data)?;
|
||||
let private_key = RsaPrivateKey::from_pkcs1_der(&args.key.data)?;
|
||||
let (padding, hashed) = match args
|
||||
.hash
|
||||
.ok_or_else(|| type_error("Missing argument hash".to_string()))?
|
||||
{
|
||||
CryptoHash::Sha1 => {
|
||||
let mut hasher = Sha1::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::PKCS1v15Sign {
|
||||
hash: Some(rsa::hash::Hash::SHA1),
|
||||
|
@ -215,7 +215,7 @@ pub async fn op_crypto_sign_key(
|
|||
}
|
||||
CryptoHash::Sha256 => {
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::PKCS1v15Sign {
|
||||
hash: Some(rsa::hash::Hash::SHA2_256),
|
||||
|
@ -225,7 +225,7 @@ pub async fn op_crypto_sign_key(
|
|||
}
|
||||
CryptoHash::Sha384 => {
|
||||
let mut hasher = Sha384::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::PKCS1v15Sign {
|
||||
hash: Some(rsa::hash::Hash::SHA2_384),
|
||||
|
@ -235,7 +235,7 @@ pub async fn op_crypto_sign_key(
|
|||
}
|
||||
CryptoHash::Sha512 => {
|
||||
let mut hasher = Sha512::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::PKCS1v15Sign {
|
||||
hash: Some(rsa::hash::Hash::SHA2_512),
|
||||
|
@ -248,7 +248,7 @@ pub async fn op_crypto_sign_key(
|
|||
private_key.sign(padding, &hashed)?
|
||||
}
|
||||
Algorithm::RsaPss => {
|
||||
let private_key = RsaPrivateKey::from_pkcs1_der(&*args.key.data)?;
|
||||
let private_key = RsaPrivateKey::from_pkcs1_der(&args.key.data)?;
|
||||
|
||||
let salt_len = args
|
||||
.salt_length
|
||||
|
@ -262,7 +262,7 @@ pub async fn op_crypto_sign_key(
|
|||
{
|
||||
CryptoHash::Sha1 => {
|
||||
let mut hasher = Sha1::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::new_pss_with_salt::<Sha1, _>(rng, salt_len),
|
||||
hasher.finalize()[..].to_vec(),
|
||||
|
@ -270,7 +270,7 @@ pub async fn op_crypto_sign_key(
|
|||
}
|
||||
CryptoHash::Sha256 => {
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::new_pss_with_salt::<Sha256, _>(rng, salt_len),
|
||||
hasher.finalize()[..].to_vec(),
|
||||
|
@ -278,7 +278,7 @@ pub async fn op_crypto_sign_key(
|
|||
}
|
||||
CryptoHash::Sha384 => {
|
||||
let mut hasher = Sha384::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::new_pss_with_salt::<Sha384, _>(rng, salt_len),
|
||||
hasher.finalize()[..].to_vec(),
|
||||
|
@ -286,7 +286,7 @@ pub async fn op_crypto_sign_key(
|
|||
}
|
||||
CryptoHash::Sha512 => {
|
||||
let mut hasher = Sha512::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::new_pss_with_salt::<Sha512, _>(rng, salt_len),
|
||||
hasher.finalize()[..].to_vec(),
|
||||
|
@ -301,7 +301,7 @@ pub async fn op_crypto_sign_key(
|
|||
let curve: &EcdsaSigningAlgorithm =
|
||||
args.named_curve.ok_or_else(not_supported)?.try_into()?;
|
||||
|
||||
let key_pair = EcdsaKeyPair::from_pkcs8(curve, &*args.key.data)?;
|
||||
let key_pair = EcdsaKeyPair::from_pkcs8(curve, &args.key.data)?;
|
||||
// We only support P256-SHA256 & P384-SHA384. These are recommended signature pairs.
|
||||
// https://briansmith.org/rustdoc/ring/signature/index.html#statics
|
||||
if let Some(hash) = args.hash {
|
||||
|
@ -320,7 +320,7 @@ pub async fn op_crypto_sign_key(
|
|||
Algorithm::Hmac => {
|
||||
let hash: HmacAlgorithm = args.hash.ok_or_else(not_supported)?.into();
|
||||
|
||||
let key = HmacKey::new(hash, &*args.key.data);
|
||||
let key = HmacKey::new(hash, &args.key.data);
|
||||
|
||||
let signature = ring::hmac::sign(&key, data);
|
||||
signature.as_ref().to_vec()
|
||||
|
@ -359,7 +359,7 @@ pub async fn op_crypto_verify_key(
|
|||
{
|
||||
CryptoHash::Sha1 => {
|
||||
let mut hasher = Sha1::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::PKCS1v15Sign {
|
||||
hash: Some(rsa::hash::Hash::SHA1),
|
||||
|
@ -369,7 +369,7 @@ pub async fn op_crypto_verify_key(
|
|||
}
|
||||
CryptoHash::Sha256 => {
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::PKCS1v15Sign {
|
||||
hash: Some(rsa::hash::Hash::SHA2_256),
|
||||
|
@ -379,7 +379,7 @@ pub async fn op_crypto_verify_key(
|
|||
}
|
||||
CryptoHash::Sha384 => {
|
||||
let mut hasher = Sha384::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::PKCS1v15Sign {
|
||||
hash: Some(rsa::hash::Hash::SHA2_384),
|
||||
|
@ -389,7 +389,7 @@ pub async fn op_crypto_verify_key(
|
|||
}
|
||||
CryptoHash::Sha512 => {
|
||||
let mut hasher = Sha512::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::PKCS1v15Sign {
|
||||
hash: Some(rsa::hash::Hash::SHA2_512),
|
||||
|
@ -399,9 +399,7 @@ pub async fn op_crypto_verify_key(
|
|||
}
|
||||
};
|
||||
|
||||
public_key
|
||||
.verify(padding, &hashed, &*args.signature)
|
||||
.is_ok()
|
||||
public_key.verify(padding, &hashed, &args.signature).is_ok()
|
||||
}
|
||||
Algorithm::RsaPss => {
|
||||
let salt_len = args
|
||||
|
@ -417,7 +415,7 @@ pub async fn op_crypto_verify_key(
|
|||
{
|
||||
CryptoHash::Sha1 => {
|
||||
let mut hasher = Sha1::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::new_pss_with_salt::<Sha1, _>(rng, salt_len),
|
||||
hasher.finalize()[..].to_vec(),
|
||||
|
@ -425,7 +423,7 @@ pub async fn op_crypto_verify_key(
|
|||
}
|
||||
CryptoHash::Sha256 => {
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::new_pss_with_salt::<Sha256, _>(rng, salt_len),
|
||||
hasher.finalize()[..].to_vec(),
|
||||
|
@ -433,7 +431,7 @@ pub async fn op_crypto_verify_key(
|
|||
}
|
||||
CryptoHash::Sha384 => {
|
||||
let mut hasher = Sha384::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::new_pss_with_salt::<Sha384, _>(rng, salt_len),
|
||||
hasher.finalize()[..].to_vec(),
|
||||
|
@ -441,7 +439,7 @@ pub async fn op_crypto_verify_key(
|
|||
}
|
||||
CryptoHash::Sha512 => {
|
||||
let mut hasher = Sha512::new();
|
||||
hasher.update(&data);
|
||||
hasher.update(data);
|
||||
(
|
||||
PaddingScheme::new_pss_with_salt::<Sha512, _>(rng, salt_len),
|
||||
hasher.finalize()[..].to_vec(),
|
||||
|
@ -449,14 +447,12 @@ pub async fn op_crypto_verify_key(
|
|||
}
|
||||
};
|
||||
|
||||
public_key
|
||||
.verify(padding, &hashed, &*args.signature)
|
||||
.is_ok()
|
||||
public_key.verify(padding, &hashed, &args.signature).is_ok()
|
||||
}
|
||||
Algorithm::Hmac => {
|
||||
let hash: HmacAlgorithm = args.hash.ok_or_else(not_supported)?.into();
|
||||
let key = HmacKey::new(hash, &*args.key.data);
|
||||
ring::hmac::verify(&key, data, &*args.signature).is_ok()
|
||||
let key = HmacKey::new(hash, &args.key.data);
|
||||
ring::hmac::verify(&key, data, &args.signature).is_ok()
|
||||
}
|
||||
Algorithm::Ecdsa => {
|
||||
let signing_alg: &EcdsaSigningAlgorithm =
|
||||
|
@ -468,7 +464,7 @@ pub async fn op_crypto_verify_key(
|
|||
|
||||
let public_key_bytes = match args.key.r#type {
|
||||
KeyType::Private => {
|
||||
private_key = EcdsaKeyPair::from_pkcs8(signing_alg, &*args.key.data)?;
|
||||
private_key = EcdsaKeyPair::from_pkcs8(signing_alg, &args.key.data)?;
|
||||
|
||||
private_key.public_key().as_ref()
|
||||
}
|
||||
|
@ -479,7 +475,7 @@ pub async fn op_crypto_verify_key(
|
|||
let public_key =
|
||||
ring::signature::UnparsedPublicKey::new(verify_alg, public_key_bytes);
|
||||
|
||||
public_key.verify(data, &*args.signature).is_ok()
|
||||
public_key.verify(data, &args.signature).is_ok()
|
||||
}
|
||||
_ => return Err(type_error("Unsupported algorithm".to_string())),
|
||||
};
|
||||
|
@ -659,9 +655,9 @@ pub async fn op_crypto_derive_bits(
|
|||
fn read_rsa_public_key(key_data: KeyData) -> Result<RsaPublicKey, AnyError> {
|
||||
let public_key = match key_data.r#type {
|
||||
KeyType::Private => {
|
||||
RsaPrivateKey::from_pkcs1_der(&*key_data.data)?.to_public_key()
|
||||
RsaPrivateKey::from_pkcs1_der(&key_data.data)?.to_public_key()
|
||||
}
|
||||
KeyType::Public => RsaPublicKey::from_pkcs1_der(&*key_data.data)?,
|
||||
KeyType::Public => RsaPublicKey::from_pkcs1_der(&key_data.data)?,
|
||||
KeyType::Secret => unreachable!("unexpected KeyType::Secret"),
|
||||
};
|
||||
Ok(public_key)
|
||||
|
|
|
@ -89,7 +89,7 @@ impl RawKeyData {
|
|||
match self {
|
||||
RawKeyData::Public(data) => {
|
||||
// public_key is a serialized EncodedPoint
|
||||
p256::EncodedPoint::from_bytes(&data)
|
||||
p256::EncodedPoint::from_bytes(data)
|
||||
.map_err(|_| type_error("expected valid public EC key"))
|
||||
}
|
||||
RawKeyData::Private(data) => {
|
||||
|
@ -106,7 +106,7 @@ impl RawKeyData {
|
|||
match self {
|
||||
RawKeyData::Public(data) => {
|
||||
// public_key is a serialized EncodedPoint
|
||||
p384::EncodedPoint::from_bytes(&data)
|
||||
p384::EncodedPoint::from_bytes(data)
|
||||
.map_err(|_| type_error("expected valid public EC key"))
|
||||
}
|
||||
RawKeyData::Private(data) => {
|
||||
|
|
|
@ -198,7 +198,7 @@ where
|
|||
let permissions = state.borrow_mut::<NP>();
|
||||
permissions.check_read(address_path, "Deno.listen()")?;
|
||||
permissions.check_write(address_path, "Deno.listen()")?;
|
||||
let listener = UnixListener::bind(&address_path)?;
|
||||
let listener = UnixListener::bind(address_path)?;
|
||||
let local_addr = listener.local_addr()?;
|
||||
let pathname = local_addr.as_pathname().map(pathstring).transpose()?;
|
||||
let listener_resource = UnixListenerResource {
|
||||
|
@ -220,7 +220,7 @@ where
|
|||
let permissions = state.borrow_mut::<NP>();
|
||||
permissions.check_read(address_path, "Deno.listenDatagram()")?;
|
||||
permissions.check_write(address_path, "Deno.listenDatagram()")?;
|
||||
let socket = UnixDatagram::bind(&address_path)?;
|
||||
let socket = UnixDatagram::bind(address_path)?;
|
||||
let local_addr = socket.local_addr()?;
|
||||
let pathname = local_addr.as_pathname().map(pathstring).transpose()?;
|
||||
let datagram_resource = UnixDatagramResource {
|
||||
|
|
|
@ -47,8 +47,6 @@ struct Op {
|
|||
|
||||
impl Op {
|
||||
fn new(mut item: ItemFn, attrs: Attributes) -> Self {
|
||||
add_scope_lifetime(&mut item);
|
||||
|
||||
// Preserve the original function. Change the name to `call`.
|
||||
//
|
||||
// impl op_foo {
|
||||
|
@ -58,6 +56,8 @@ impl Op {
|
|||
let mut orig = item.clone();
|
||||
orig.sig.ident = Ident::new("call", Span::call_site());
|
||||
|
||||
add_scope_lifetime(&mut item);
|
||||
|
||||
let is_async = item.sig.asyncness.is_some() || is_future(&item.sig.output);
|
||||
let type_params = exclude_lifetime_params(&item.sig.generics.params);
|
||||
let core = deno::import();
|
||||
|
|
|
@ -36,7 +36,7 @@ mod not_docs {
|
|||
}
|
||||
|
||||
let snapshot = js_runtime.snapshot();
|
||||
let snapshot_slice: &[u8] = &*snapshot;
|
||||
let snapshot_slice: &[u8] = &snapshot;
|
||||
println!("Snapshot size: {}", snapshot_slice.len());
|
||||
|
||||
let compressed_snapshot_with_size = {
|
||||
|
@ -63,7 +63,7 @@ mod not_docs {
|
|||
compressed_snapshot_with_size.len()
|
||||
);
|
||||
|
||||
std::fs::write(&snapshot_path, compressed_snapshot_with_size).unwrap();
|
||||
std::fs::write(snapshot_path, compressed_snapshot_with_size).unwrap();
|
||||
println!("Snapshot written to: {} ", snapshot_path.display());
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ pub fn get_error_class_name(e: &AnyError) -> Option<&'static str> {
|
|||
.or_else(|| e.downcast_ref::<hyper::Error>().map(get_hyper_error_class))
|
||||
.or_else(|| {
|
||||
e.downcast_ref::<Arc<hyper::Error>>()
|
||||
.map(|e| get_hyper_error_class(&**e))
|
||||
.map(|e| get_hyper_error_class(e))
|
||||
})
|
||||
.or_else(|| {
|
||||
e.downcast_ref::<deno_core::Canceled>().map(|e| {
|
||||
|
|
|
@ -195,7 +195,7 @@ fn find_recursive_cause(js_error: &JsError) -> Option<ErrorReference> {
|
|||
{
|
||||
return Some(ErrorReference {
|
||||
from: current_error,
|
||||
to: *seen,
|
||||
to: seen,
|
||||
});
|
||||
} else {
|
||||
current_error = cause;
|
||||
|
|
|
@ -30,7 +30,7 @@ pub static CLI_SNAPSHOT: Lazy<Box<[u8]>> = Lazy::new(
|
|||
|
||||
pub fn deno_isolate_init() -> Snapshot {
|
||||
debug!("Deno isolate init with snapshots.");
|
||||
Snapshot::Static(&*CLI_SNAPSHOT)
|
||||
Snapshot::Static(&CLI_SNAPSHOT)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -271,7 +271,7 @@ async fn op_write_file_async(
|
|||
None => None,
|
||||
};
|
||||
let (path, open_options) = open_helper(
|
||||
&mut *state.borrow_mut(),
|
||||
&mut state.borrow_mut(),
|
||||
&path,
|
||||
mode,
|
||||
Some(&write_open_options(create, append)),
|
||||
|
@ -646,7 +646,7 @@ fn raw_chmod(path: &Path, _raw_mode: u32) -> Result<(), AnyError> {
|
|||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let permissions = PermissionsExt::from_mode(_raw_mode);
|
||||
std::fs::set_permissions(&path, permissions).map_err(err_mapper)?;
|
||||
std::fs::set_permissions(path, permissions).map_err(err_mapper)?;
|
||||
Ok(())
|
||||
}
|
||||
// TODO Implement chmod for Windows (#4357)
|
||||
|
|
|
@ -184,7 +184,7 @@ fn op_create_worker(
|
|||
state.put::<WorkerId>(worker_id.next().unwrap());
|
||||
|
||||
let module_specifier = deno_core::resolve_url(&specifier)?;
|
||||
let worker_name = args_name.unwrap_or_else(|| "".to_string());
|
||||
let worker_name = args_name.unwrap_or_default();
|
||||
|
||||
let (handle_sender, handle_receiver) = std::sync::mpsc::sync_channel::<
|
||||
Result<SendableWebWorkerHandle, AnyError>,
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[toolchain]
|
||||
channel = "1.64.0"
|
||||
channel = "1.65.0"
|
||||
components = ["rustfmt", "clippy"]
|
||||
|
|
|
@ -434,7 +434,7 @@ impl<'de, 'a, 'b, 's, 'x> de::Deserializer<'de>
|
|||
V: Visitor<'de>,
|
||||
{
|
||||
magic::buffer::ZeroCopyBuf::from_v8(self.scope, self.input)
|
||||
.and_then(|zb| visitor.visit_bytes(&*zb))
|
||||
.and_then(|zb| visitor.visit_bytes(&zb))
|
||||
}
|
||||
|
||||
fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value>
|
||||
|
|
|
@ -1088,7 +1088,7 @@ async fn download_npm_registry_file(
|
|||
.into_bytes()
|
||||
};
|
||||
std::fs::create_dir_all(file_path.parent().unwrap())?;
|
||||
std::fs::write(&file_path, bytes)?;
|
||||
std::fs::write(file_path, bytes)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -1918,7 +1918,7 @@ impl<'a> CheckOutputIntegrationTest<'a> {
|
|||
command.env_clear();
|
||||
}
|
||||
command.envs(self.envs.clone());
|
||||
command.current_dir(&cwd);
|
||||
command.current_dir(cwd);
|
||||
command.stdin(Stdio::piped());
|
||||
let writer_clone = writer.try_clone().unwrap();
|
||||
command.stderr(writer_clone);
|
||||
|
@ -2163,13 +2163,13 @@ pub fn parse_wrk_output(output: &str) -> WrkOutput {
|
|||
let mut latency = None;
|
||||
|
||||
for line in output.lines() {
|
||||
if requests == None {
|
||||
if requests.is_none() {
|
||||
if let Some(cap) = REQUESTS_RX.captures(line) {
|
||||
requests =
|
||||
Some(str::parse::<u64>(cap.get(1).unwrap().as_str()).unwrap());
|
||||
}
|
||||
}
|
||||
if latency == None {
|
||||
if latency.is_none() {
|
||||
if let Some(cap) = LATENCY_RX.captures(line) {
|
||||
let time = cap.get(1).unwrap();
|
||||
let unit = cap.get(2).unwrap();
|
||||
|
|
Loading…
Reference in a new issue