1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

chore: update to Rust 1.66.0 (#17078)

This commit is contained in:
linbingquan 2022-12-18 06:20:15 +08:00 committed by GitHub
parent f2c9cc500c
commit f46df3e359
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 84 additions and 84 deletions

View file

@ -593,7 +593,7 @@ impl ConfigFile {
pub fn from_specifier(specifier: &ModuleSpecifier) -> Result<Self, AnyError> {
let config_path = specifier_to_file_path(specifier)?;
let config_text = match std::fs::read_to_string(&config_path) {
let config_text = match std::fs::read_to_string(config_path) {
Ok(text) => text,
Err(err) => bail!(
"Error reading config file {}: {}",

View file

@ -150,7 +150,7 @@ pub fn get_root_cert_store(
} else {
PathBuf::from(ca_file)
};
let certfile = std::fs::File::open(&ca_file)?;
let certfile = std::fs::File::open(ca_file)?;
let mut reader = BufReader::new(certfile);
match rustls_pemfile::certs(&mut reader) {
@ -720,7 +720,7 @@ mod test {
let import_map_path =
std::env::current_dir().unwrap().join("import-map.json");
let expected_specifier =
ModuleSpecifier::from_file_path(&import_map_path).unwrap();
ModuleSpecifier::from_file_path(import_map_path).unwrap();
assert!(actual.is_ok());
let actual = actual.unwrap();
assert_eq!(actual, Some(expected_specifier));

View file

@ -433,7 +433,7 @@ async fn main() -> Result<()> {
let target_dir = test_util::target_dir();
let deno_exe = test_util::deno_exe_path();
env::set_current_dir(&test_util::root_path())?;
env::set_current_dir(test_util::root_path())?;
let mut new_data = BenchResult {
created_at: chrono::Utc::now()

View file

@ -136,7 +136,7 @@ impl DiskCache {
pub fn get(&self, filename: &Path) -> std::io::Result<Vec<u8>> {
let path = self.location.join(filename);
fs::read(&path)
fs::read(path)
}
pub fn set(&self, filename: &Path, data: &[u8]) -> std::io::Result<()> {

View file

@ -587,11 +587,11 @@ mod tests {
let file_c = dir_a.join("c.ts");
std::fs::write(&file_c, b"").expect("could not create");
let file_d = dir_b.join("d.ts");
std::fs::write(&file_d, b"").expect("could not create");
std::fs::write(file_d, b"").expect("could not create");
let file_e = dir_a.join("e.txt");
std::fs::write(&file_e, b"").expect("could not create");
std::fs::write(file_e, b"").expect("could not create");
let file_f = dir_a.join("f.mjs");
std::fs::write(&file_f, b"").expect("could not create");
std::fs::write(file_f, b"").expect("could not create");
let specifier =
ModuleSpecifier::from_file_path(file_c).expect("could not create");
let actual = get_local_completions(

View file

@ -1266,7 +1266,7 @@ fn lsp_deno_graph_analyze(
use deno_graph::ModuleParser;
let analyzer = deno_graph::CapturingModuleAnalyzer::new(
Some(Box::new(LspModuleParser::default())),
Some(Box::<LspModuleParser>::default()),
None,
);
let parsed_source_result = analyzer.parse_module(

View file

@ -955,7 +955,7 @@ impl ModuleRegistry {
None
} else {
Some(lsp::CompletionList {
items: completions.into_iter().map(|(_, i)| i).collect(),
items: completions.into_values().collect(),
is_incomplete,
})
};

View file

@ -1969,7 +1969,7 @@ impl CompletionEntryDetails {
let detail = if original_item.detail.is_some() {
original_item.detail.clone()
} else if !self.display_parts.is_empty() {
Some(replace_links(&display_parts_to_string(
Some(replace_links(display_parts_to_string(
&self.display_parts,
language_server,
)))

View file

@ -549,7 +549,7 @@ fn napi_create_string_latin1(
.unwrap()
.as_bytes()
} else {
std::slice::from_raw_parts(string, length as usize)
std::slice::from_raw_parts(string, length)
};
match v8::String::new_from_one_byte(
&mut env.scope(),
@ -626,7 +626,7 @@ fn napi_create_string_utf8(
.to_str()
.unwrap()
} else {
let string = std::slice::from_raw_parts(string, length as usize);
let string = std::slice::from_raw_parts(string, length);
std::str::from_utf8(string).unwrap()
};
let v8str = v8::String::new(&mut env.scope(), string).unwrap();
@ -1070,7 +1070,7 @@ fn napi_call_function(
.map_err(|_| Error::FunctionExpected)?;
let argv: &[v8::Local<v8::Value>] =
transmute(std::slice::from_raw_parts(argv, argc as usize));
transmute(std::slice::from_raw_parts(argv, argc));
let ret = func.call(&mut env.scope(), recv, argv);
if !result.is_null() {
*result = transmute::<Option<v8::Local<v8::Value>>, napi_value>(ret);

View file

@ -759,7 +759,7 @@ fn finalize_resolution(
p_str.to_string()
};
let (is_dir, is_file) = if let Ok(stats) = std::fs::metadata(&p) {
let (is_dir, is_file) = if let Ok(stats) = std::fs::metadata(p) {
(stats.is_dir(), stats.is_file())
} else {
(false, false)
@ -958,7 +958,7 @@ pub fn translate_cjs_to_esm(
npm_resolver,
)?;
let reexport_specifier =
ModuleSpecifier::from_file_path(&resolved_reexport).unwrap();
ModuleSpecifier::from_file_path(resolved_reexport).unwrap();
// Second, read the source code from disk
let reexport_file = file_fetcher
.get_source(&reexport_specifier)

View file

@ -342,7 +342,7 @@ async fn sync_resolution_with_fs(
for package in &package_partitions.copy_packages {
let package_cache_folder_id = package.get_package_cache_folder_id();
let destination_path = deno_local_registry_dir
.join(&get_package_folder_id_folder_name(&package_cache_folder_id));
.join(get_package_folder_id_folder_name(&package_cache_folder_id));
let initialized_file = destination_path.join(".initialized");
if !initialized_file.exists() {
let sub_node_modules = destination_path.join("node_modules");
@ -352,7 +352,7 @@ async fn sync_resolution_with_fs(
})?;
let source_path = join_package_name(
&deno_local_registry_dir
.join(&get_package_folder_id_folder_name(
.join(get_package_folder_id_folder_name(
&package_cache_folder_id.with_no_count(),
))
.join("node_modules"),
@ -372,7 +372,7 @@ async fn sync_resolution_with_fs(
// node_modules/.deno/<dep_id>/node_modules/<dep_package_name>
for package in &all_packages {
let sub_node_modules = deno_local_registry_dir
.join(&get_package_folder_id_folder_name(
.join(get_package_folder_id_folder_name(
&package.get_package_cache_folder_id(),
))
.join("node_modules");
@ -419,7 +419,7 @@ async fn sync_resolution_with_fs(
let package = snapshot.package_from_id(&package_id).unwrap();
let local_registry_package_path = join_package_name(
&deno_local_registry_dir
.join(&get_package_folder_id_folder_name(
.join(get_package_folder_id_folder_name(
&package.get_package_cache_folder_id(),
))
.join("node_modules"),

View file

@ -355,7 +355,7 @@ impl RequireNpmResolver for NpmPackageResolver {
fn in_npm_package(&self, path: &Path) -> bool {
let specifier =
match ModuleSpecifier::from_file_path(&path.to_path_buf().clean()) {
match ModuleSpecifier::from_file_path(path.to_path_buf().clean()) {
Ok(p) => p,
Err(_) => return false,
};
@ -370,7 +370,7 @@ impl RequireNpmResolver for NpmPackageResolver {
}
fn path_to_specifier(path: &Path) -> Result<ModuleSpecifier, AnyError> {
match ModuleSpecifier::from_file_path(&path.to_path_buf().clean()) {
match ModuleSpecifier::from_file_path(path.to_path_buf().clean()) {
Ok(specifier) => Ok(specifier),
Err(()) => bail!("Could not convert '{}' to url.", path.display()),
}

View file

@ -51,7 +51,7 @@ mod coverage {
// Write the inital mod.ts file
std::fs::copy(mod_before_path, &mod_temp_path).unwrap();
// And the test file
std::fs::copy(mod_test_path, &mod_test_temp_path).unwrap();
std::fs::copy(mod_test_path, mod_test_temp_path).unwrap();
// Generate coverage
let status = util::deno_cmd_with_deno_dir(&deno_dir)

View file

@ -17,21 +17,21 @@ mod fmt {
testdata_fmt_dir.join("badly_formatted.mjs");
let badly_formatted_js = t.path().join("badly_formatted.js");
let badly_formatted_js_str = badly_formatted_js.to_str().unwrap();
std::fs::copy(&badly_formatted_original_js, &badly_formatted_js).unwrap();
std::fs::copy(badly_formatted_original_js, &badly_formatted_js).unwrap();
let fixed_md = testdata_fmt_dir.join("badly_formatted_fixed.md");
let badly_formatted_original_md =
testdata_fmt_dir.join("badly_formatted.md");
let badly_formatted_md = t.path().join("badly_formatted.md");
let badly_formatted_md_str = badly_formatted_md.to_str().unwrap();
std::fs::copy(&badly_formatted_original_md, &badly_formatted_md).unwrap();
std::fs::copy(badly_formatted_original_md, &badly_formatted_md).unwrap();
let fixed_json = testdata_fmt_dir.join("badly_formatted_fixed.json");
let badly_formatted_original_json =
testdata_fmt_dir.join("badly_formatted.json");
let badly_formatted_json = t.path().join("badly_formatted.json");
let badly_formatted_json_str = badly_formatted_json.to_str().unwrap();
std::fs::copy(&badly_formatted_original_json, &badly_formatted_json)
std::fs::copy(badly_formatted_original_json, &badly_formatted_json)
.unwrap();
// First, check formatting by ignoring the badly formatted file.
let status = util::deno_cmd()

View file

@ -2505,7 +2505,7 @@ mod run {
.unwrap();
assert!(status.success());
std::fs::write(&mod1_path, "export { foo } from \"./mod2.ts\";").unwrap();
std::fs::write(&mod2_path, "(").unwrap();
std::fs::write(mod2_path, "(").unwrap();
let status = deno_cmd
.current_dir(util::testdata_path())
.arg("run")
@ -2528,7 +2528,7 @@ mod run {
let mut deno_cmd = util::deno_cmd();
// With a fresh `DENO_DIR`, run a module with a dependency and a type error.
std::fs::write(&mod1_path, "import './mod2.ts'; Deno.exit('0');").unwrap();
std::fs::write(&mod2_path, "console.log('Hello, world!');").unwrap();
std::fs::write(mod2_path, "console.log('Hello, world!');").unwrap();
let status = deno_cmd
.current_dir(util::testdata_path())
.arg("run")
@ -2969,7 +2969,7 @@ mod run {
assert!(output.status.success());
let prg = util::deno_exe_path();
let output = Command::new(&prg)
let output = Command::new(prg)
.env("DENO_DIR", deno_dir.path())
.env("HTTP_PROXY", "http://nil")
.env("NO_COLOR", "1")

View file

@ -105,7 +105,7 @@ mod watcher {
util::testdata_path().join("lint/watch/badly_linted_fixed2.js.out");
let badly_linted = t.path().join("badly_linted.js");
std::fs::copy(&badly_linted_original, &badly_linted).unwrap();
std::fs::copy(badly_linted_original, &badly_linted).unwrap();
let mut child = util::deno_cmd()
.current_dir(util::testdata_path())
@ -125,7 +125,7 @@ mod watcher {
assert_eq!(output, expected);
// Change content of the file again to be badly-linted1
std::fs::copy(&badly_linted_fixed1, &badly_linted).unwrap();
std::fs::copy(badly_linted_fixed1, &badly_linted).unwrap();
std::thread::sleep(std::time::Duration::from_secs(1));
output = read_all_lints(&mut stderr_lines);
@ -133,7 +133,7 @@ mod watcher {
assert_eq!(output, expected);
// Change content of the file again to be badly-linted1
std::fs::copy(&badly_linted_fixed2, &badly_linted).unwrap();
std::fs::copy(badly_linted_fixed2, &badly_linted).unwrap();
output = read_all_lints(&mut stderr_lines);
let expected = std::fs::read_to_string(badly_linted_fixed2_output).unwrap();
@ -163,7 +163,7 @@ mod watcher {
util::testdata_path().join("lint/watch/badly_linted_fixed2.js.out");
let badly_linted = t.path().join("badly_linted.js");
std::fs::copy(&badly_linted_original, &badly_linted).unwrap();
std::fs::copy(badly_linted_original, &badly_linted).unwrap();
let mut child = util::deno_cmd()
.current_dir(t.path())
@ -183,14 +183,14 @@ mod watcher {
assert_eq!(output, expected);
// Change content of the file again to be badly-linted1
std::fs::copy(&badly_linted_fixed1, &badly_linted).unwrap();
std::fs::copy(badly_linted_fixed1, &badly_linted).unwrap();
output = read_all_lints(&mut stderr_lines);
let expected = std::fs::read_to_string(badly_linted_fixed1_output).unwrap();
assert_eq!(output, expected);
// Change content of the file again to be badly-linted1
std::fs::copy(&badly_linted_fixed2, &badly_linted).unwrap();
std::fs::copy(badly_linted_fixed2, &badly_linted).unwrap();
std::thread::sleep(std::time::Duration::from_secs(1));
output = read_all_lints(&mut stderr_lines);
@ -216,8 +216,8 @@ mod watcher {
let badly_linted_1 = t.path().join("badly_linted_1.js");
let badly_linted_2 = t.path().join("badly_linted_2.js");
std::fs::copy(&badly_linted_fixed0, &badly_linted_1).unwrap();
std::fs::copy(&badly_linted_fixed1, &badly_linted_2).unwrap();
std::fs::copy(badly_linted_fixed0, badly_linted_1).unwrap();
std::fs::copy(badly_linted_fixed1, &badly_linted_2).unwrap();
let mut child = util::deno_cmd()
.current_dir(util::testdata_path())
@ -236,7 +236,7 @@ mod watcher {
"Checked 2 files"
);
std::fs::copy(&badly_linted_fixed2, &badly_linted_2).unwrap();
std::fs::copy(badly_linted_fixed2, badly_linted_2).unwrap();
assert_contains!(
read_line("Checked", &mut stderr_lines),
@ -356,7 +356,7 @@ mod watcher {
let badly_formatted_1 = t.path().join("badly_formatted_1.js");
let badly_formatted_2 = t.path().join("badly_formatted_2.js");
std::fs::copy(&badly_formatted_original, &badly_formatted_1).unwrap();
std::fs::copy(&badly_formatted_original, &badly_formatted_2).unwrap();
std::fs::copy(&badly_formatted_original, badly_formatted_2).unwrap();
let mut child = util::deno_cmd()
.current_dir(&fmt_testdata_path)
@ -868,7 +868,7 @@ mod watcher {
)
.unwrap();
write(
&bar_test,
bar_test,
"import bar from './bar.js'; Deno.test('bar', bar);",
)
.unwrap();
@ -1102,7 +1102,7 @@ mod watcher {
.unwrap();
let file_to_watch2 = t.path().join("imported.js");
write(
&file_to_watch2,
file_to_watch2,
r#"
import "./imported2.js";
console.log("I'm dynamically imported and I cause restarts!");

View file

@ -73,8 +73,8 @@ pub fn merge_scripts(
}
let functions: Vec<FunctionCoverage> = range_to_funcs
.into_iter()
.map(|(_, funcs)| merge_functions(funcs).unwrap())
.into_values()
.map(|funcs| merge_functions(funcs).unwrap())
.collect();
Some(ScriptCoverage {

View file

@ -70,7 +70,7 @@ fn print_cache_info(
if let Some(location) = &location {
origin_dir =
origin_dir.join(&checksum::gen(&[location.to_string().as_bytes()]));
origin_dir.join(checksum::gen(&[location.to_string().as_bytes()]));
}
let local_storage_dir = origin_dir.join("local_storage");
@ -526,11 +526,9 @@ impl<'a> GraphDisplayContext<'a> {
Specifier(_) => specifier_str,
};
let maybe_size = match &package_or_specifier {
Package(package) => self
.npm_info
.package_sizes
.get(&package.id)
.map(|s| *s as u64),
Package(package) => {
self.npm_info.package_sizes.get(&package.id).copied()
}
Specifier(_) => module
.maybe_source
.as_ref()

View file

@ -77,7 +77,7 @@ deno {} "$@"
"#,
args.join(" "),
);
let mut file = File::create(&shim_data.file_path.with_extension(""))?;
let mut file = File::create(shim_data.file_path.with_extension(""))?;
file.write_all(template.as_bytes())?;
Ok(())
}
@ -1127,11 +1127,11 @@ mod tests {
// create extra files
{
let file_path = file_path.with_extension("tsconfig.json");
File::create(&file_path).unwrap();
File::create(file_path).unwrap();
}
{
let file_path = file_path.with_extension("lock.json");
File::create(&file_path).unwrap();
File::create(file_path).unwrap();
}
uninstall("echo_test".to_string(), Some(temp_dir.path().to_path_buf()))

View file

@ -120,7 +120,7 @@ fn validate_options(
format!("Failed to canonicalize: {}", output_dir.display())
})?;
if import_map_path.starts_with(&output_dir) {
if import_map_path.starts_with(output_dir) {
// canonicalize to make the test for this pass on the CI
let cwd = canonicalize_path(&std::env::current_dir()?)?;
// We don't allow using the output directory to help generate the

View file

@ -192,7 +192,7 @@ impl VendorTestBuilder {
}
pub fn new_import_map(&self, base_path: &str) -> ImportMap {
let base = ModuleSpecifier::from_file_path(&make_path(base_path)).unwrap();
let base = ModuleSpecifier::from_file_path(make_path(base_path)).unwrap();
ImportMap::new(base)
}

View file

@ -858,7 +858,7 @@ mod tests {
.replace("://", "_")
.replace('/', "-");
let source_path = self.fixtures.join(specifier_text);
let response = fs::read_to_string(&source_path)
let response = fs::read_to_string(source_path)
.map(|c| {
Some(deno_graph::source::LoadResponse::Module {
specifier: specifier.clone(),

View file

@ -160,7 +160,7 @@ pub fn resolve_from_cwd(path: &Path) -> Result<PathBuf, AnyError> {
cwd.join(path)
};
Ok(normalize_path(&resolved_path))
Ok(normalize_path(resolved_path))
}
/// Collects file paths that satisfy the given predicate, by recursively walking `files`.
@ -280,7 +280,7 @@ pub fn collect_specifiers(
} else {
root_path.join(path)
};
let p = normalize_path(&p);
let p = normalize_path(p);
if p.is_dir() {
let test_files = file_collector.collect_files(&[p])?;
let mut test_files_as_urls = test_files

View file

@ -75,9 +75,7 @@ impl ProgressBarRenderer for BarProgressBarRenderer {
));
}
text.push_str(&elapsed_text);
let max_width =
std::cmp::max(10, std::cmp::min(75, data.terminal_width as i32 - 5))
as usize;
let max_width = (data.terminal_width as i32 - 5).clamp(10, 75) as usize;
let same_line_text_width =
elapsed_text.len() + total_text_max_width + bytes_text_max_width + 3; // space, open and close brace
let total_bars = if same_line_text_width > max_width {

View file

@ -141,7 +141,7 @@ pub fn resolve_path(
let path = current_dir()
.map_err(|_| ModuleResolutionError::InvalidPath(path_str.into()))?
.join(path_str);
let path = normalize_path(&path);
let path = normalize_path(path);
Url::from_file_path(path.clone())
.map_err(|()| ModuleResolutionError::InvalidPath(path))
}

View file

@ -2116,7 +2116,7 @@ impl JsRuntime {
let (promise_id, op_id, mut resp) = item;
state.unrefed_ops.remove(&promise_id);
state.op_state.borrow().tracker.track_async_completed(op_id);
args.push(v8::Integer::new(scope, promise_id as i32).into());
args.push(v8::Integer::new(scope, promise_id).into());
args.push(match resp.to_v8(scope) {
Ok(v) => v,
Err(e) => OpResult::Err(OpError::new(&|_| "TypeError", e.into()))

2
ext/cache/sqlite.rs vendored
View file

@ -114,7 +114,7 @@ impl Cache for SqliteBackedCache {
},
)?;
let responses_dir = get_responses_dir(cache_storage_dir, cache_id);
std::fs::create_dir_all(&responses_dir)?;
std::fs::create_dir_all(responses_dir)?;
Ok::<i64, AnyError>(cache_id)
})
.await?

View file

@ -171,7 +171,7 @@ unsafe fn do_ffi_callback(
let func = callback.open(scope);
let result = result as *mut c_void;
let vals: &[*const c_void] =
std::slice::from_raw_parts(args, info.parameters.len() as usize);
std::slice::from_raw_parts(args, info.parameters.len());
let mut params: Vec<v8::Local<v8::Value>> = vec![];
for (native_type, val) in info.parameters.iter().zip(vals) {
@ -307,7 +307,7 @@ unsafe fn do_ffi_callback(
// Fallthrough, probably UB.
value
.int32_value(scope)
.expect("Unable to deserialize result parameter.") as i32
.expect("Unable to deserialize result parameter.")
};
*(result as *mut i32) = value;
}
@ -425,8 +425,7 @@ unsafe fn do_ffi_callback(
} else {
*(result as *mut i64) = value
.integer_value(scope)
.expect("Unable to deserialize result parameter.")
as i64;
.expect("Unable to deserialize result parameter.");
}
}
NativeType::U64 => {

View file

@ -250,7 +250,7 @@ pub fn ffi_parse_u32_arg(
) -> Result<NativeValue, AnyError> {
let u32_value = v8::Local::<v8::Uint32>::try_from(arg)
.map_err(|_| type_error("Invalid FFI u32 type, expected unsigned integer"))?
.value() as u32;
.value();
Ok(NativeValue { u32_value })
}
@ -260,7 +260,7 @@ pub fn ffi_parse_i32_arg(
) -> Result<NativeValue, AnyError> {
let i32_value = v8::Local::<v8::Int32>::try_from(arg)
.map_err(|_| type_error("Invalid FFI i32 type, expected integer"))?
.value() as i32;
.value();
Ok(NativeValue { i32_value })
}
@ -297,7 +297,7 @@ pub fn ffi_parse_i64_arg(
{
value.i64_value().0
} else if let Ok(value) = v8::Local::<v8::Number>::try_from(arg) {
value.integer_value(scope).unwrap() as i64
value.integer_value(scope).unwrap()
} else {
return Err(type_error("Invalid FFI i64 type, expected integer"));
};
@ -358,7 +358,7 @@ pub fn ffi_parse_f64_arg(
) -> Result<NativeValue, AnyError> {
let f64_value = v8::Local::<v8::Number>::try_from(arg)
.map_err(|_| type_error("Invalid FFI f64 type, expected number"))?
.value() as f64;
.value();
Ok(NativeValue { f64_value })
}

View file

@ -301,9 +301,7 @@ where
}
// SAFETY: ptr and offset are user provided.
Ok(unsafe {
ptr::read_unaligned::<u32>(ptr.add(offset) as *const u32) as u32
})
Ok(unsafe { ptr::read_unaligned::<u32>(ptr.add(offset) as *const u32) })
}
#[op(fast)]
@ -327,9 +325,7 @@ where
}
// SAFETY: ptr and offset are user provided.
Ok(unsafe {
ptr::read_unaligned::<i32>(ptr.add(offset) as *const i32) as i32
})
Ok(unsafe { ptr::read_unaligned::<i32>(ptr.add(offset) as *const i32) })
}
#[op]

View file

@ -910,6 +910,7 @@ impl Aarch64Apple {
aarch64!(self.assmblr; str x0, [x19]);
}
#[allow(clippy::unnecessary_cast)]
fn save_frame_record(&mut self) {
debug_assert!(
self.allocated_stack >= 16,
@ -922,6 +923,7 @@ impl Aarch64Apple {
)
}
#[allow(clippy::unnecessary_cast)]
fn recover_frame_record(&mut self) {
// The stack cannot have been deallocated before the frame record is restored
debug_assert!(

View file

@ -888,7 +888,7 @@ pub fn legacy_main_resolve(
.path
.parent()
.unwrap()
.join(&format!("{}{}", main, ending))
.join(format!("{}{}", main, ending))
.clean();
if file_exists(&guess) {
// TODO(bartlomieju): emitLegacyIndexDeprecation()

View file

@ -51,7 +51,7 @@ where
// SAFETY: buffer is at least 8 bytes long.
unsafe { std::slice::from_raw_parts_mut(buf.as_mut_ptr() as _, 2) };
buf[0] = seconds as u32;
buf[1] = subsec_nanos as u32;
buf[1] = subsec_nanos;
}
pub struct TimerHandle(Rc<CancelHandle>);

View file

@ -28,7 +28,7 @@ pub fn resolve_from_cwd(path: &Path) -> Result<PathBuf, AnyError> {
} else {
let cwd =
current_dir().context("Failed to get current working directory")?;
Ok(normalize_path(&cwd.join(path)))
Ok(normalize_path(cwd.join(path)))
}
}

View file

@ -525,9 +525,16 @@ fn op_umask(state: &mut OpState, mask: Option<u32>) -> Result<u32, AnyError> {
let _ = umask(prev);
prev
};
#[cfg(target_os = "linux")]
{
Ok(r.bits())
}
#[cfg(target_os = "macos")]
{
Ok(r.bits() as u32)
}
}
}
#[op]
fn op_chdir(state: &mut OpState, directory: String) -> Result<(), AnyError> {

View file

@ -1,3 +1,3 @@
[toolchain]
channel = "1.65.0"
channel = "1.66.0"
components = ["rustfmt", "clippy"]

View file

@ -170,11 +170,11 @@ impl<'de, 'a, 'b, 's, 'x> de::Deserializer<'de>
{
visitor.visit_f64(
if let Ok(x) = v8::Local::<v8::Number>::try_from(self.input) {
x.value() as f64
x.value()
} else if let Ok(x) = v8::Local::<v8::BigInt>::try_from(self.input) {
bigint_to_f64(x)
} else if let Some(x) = self.input.number_value(self.scope) {
x as f64
x
} else if let Some(x) = self.input.to_big_int(self.scope) {
bigint_to_f64(x)
} else {