summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/args/config_file.rs2
-rw-r--r--cli/args/mod.rs4
-rw-r--r--cli/bench/main.rs2
-rw-r--r--cli/cache/disk_cache.rs2
-rw-r--r--cli/lsp/completions.rs6
-rw-r--r--cli/lsp/documents.rs2
-rw-r--r--cli/lsp/registries.rs2
-rw-r--r--cli/lsp/tsc.rs2
-rw-r--r--cli/napi/js_native_api.rs6
-rw-r--r--cli/node/mod.rs4
-rw-r--r--cli/npm/resolvers/local.rs8
-rw-r--r--cli/npm/resolvers/mod.rs4
-rw-r--r--cli/tests/coverage_tests.rs2
-rw-r--r--cli/tests/fmt_tests.rs6
-rw-r--r--cli/tests/run_tests.rs6
-rw-r--r--cli/tests/watcher_tests.rs24
-rw-r--r--cli/tools/coverage/merge.rs4
-rw-r--r--cli/tools/info.rs10
-rw-r--r--cli/tools/installer.rs6
-rw-r--r--cli/tools/vendor/mod.rs2
-rw-r--r--cli/tools/vendor/test.rs2
-rw-r--r--cli/tsc/mod.rs2
-rw-r--r--cli/util/fs.rs4
-rw-r--r--cli/util/progress_bar/renderer.rs4
-rw-r--r--core/module_specifier.rs2
-rw-r--r--core/runtime.rs2
-rw-r--r--ext/cache/sqlite.rs2
-rw-r--r--ext/ffi/callback.rs7
-rw-r--r--ext/ffi/ir.rs8
-rw-r--r--ext/ffi/repr.rs8
-rw-r--r--ext/ffi/turbocall.rs2
-rw-r--r--ext/node/resolution.rs2
-rw-r--r--ext/web/timers.rs2
-rw-r--r--runtime/fs_util.rs2
-rw-r--r--runtime/ops/fs.rs9
-rw-r--r--rust-toolchain.toml2
-rw-r--r--serde_v8/de.rs4
37 files changed, 84 insertions, 84 deletions
diff --git a/cli/args/config_file.rs b/cli/args/config_file.rs
index 904efdff8..0fa8e4d61 100644
--- a/cli/args/config_file.rs
+++ b/cli/args/config_file.rs
@@ -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 {}: {}",
diff --git a/cli/args/mod.rs b/cli/args/mod.rs
index f936f9c25..09690412d 100644
--- a/cli/args/mod.rs
+++ b/cli/args/mod.rs
@@ -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));
diff --git a/cli/bench/main.rs b/cli/bench/main.rs
index c756c2c2e..02df982d8 100644
--- a/cli/bench/main.rs
+++ b/cli/bench/main.rs
@@ -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()
diff --git a/cli/cache/disk_cache.rs b/cli/cache/disk_cache.rs
index 60e353d85..894b96d2a 100644
--- a/cli/cache/disk_cache.rs
+++ b/cli/cache/disk_cache.rs
@@ -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<()> {
diff --git a/cli/lsp/completions.rs b/cli/lsp/completions.rs
index 5e0fad0f4..7a93c8baf 100644
--- a/cli/lsp/completions.rs
+++ b/cli/lsp/completions.rs
@@ -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(
diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs
index 82e2618b3..936d225ec 100644
--- a/cli/lsp/documents.rs
+++ b/cli/lsp/documents.rs
@@ -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(
diff --git a/cli/lsp/registries.rs b/cli/lsp/registries.rs
index 1488077dd..aeaa4c012 100644
--- a/cli/lsp/registries.rs
+++ b/cli/lsp/registries.rs
@@ -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,
})
};
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index 1152c080d..5d5b8213b 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -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,
)))
diff --git a/cli/napi/js_native_api.rs b/cli/napi/js_native_api.rs
index dedea8f79..256584a13 100644
--- a/cli/napi/js_native_api.rs
+++ b/cli/napi/js_native_api.rs
@@ -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);
diff --git a/cli/node/mod.rs b/cli/node/mod.rs
index 190f386a7..19bc4ed14 100644
--- a/cli/node/mod.rs
+++ b/cli/node/mod.rs
@@ -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)
diff --git a/cli/npm/resolvers/local.rs b/cli/npm/resolvers/local.rs
index 69f275c70..5343dc2b4 100644
--- a/cli/npm/resolvers/local.rs
+++ b/cli/npm/resolvers/local.rs
@@ -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"),
diff --git a/cli/npm/resolvers/mod.rs b/cli/npm/resolvers/mod.rs
index a9c459d12..0f1ed5d85 100644
--- a/cli/npm/resolvers/mod.rs
+++ b/cli/npm/resolvers/mod.rs
@@ -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()),
}
diff --git a/cli/tests/coverage_tests.rs b/cli/tests/coverage_tests.rs
index 6515fd6ec..357d54ee6 100644
--- a/cli/tests/coverage_tests.rs
+++ b/cli/tests/coverage_tests.rs
@@ -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)
diff --git a/cli/tests/fmt_tests.rs b/cli/tests/fmt_tests.rs
index 6ace4ce5b..807306b2c 100644
--- a/cli/tests/fmt_tests.rs
+++ b/cli/tests/fmt_tests.rs
@@ -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()
diff --git a/cli/tests/run_tests.rs b/cli/tests/run_tests.rs
index 6cae9d9e3..6196f641d 100644
--- a/cli/tests/run_tests.rs
+++ b/cli/tests/run_tests.rs
@@ -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")
diff --git a/cli/tests/watcher_tests.rs b/cli/tests/watcher_tests.rs
index f9c8e1508..06af71eb4 100644
--- a/cli/tests/watcher_tests.rs
+++ b/cli/tests/watcher_tests.rs
@@ -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!");
diff --git a/cli/tools/coverage/merge.rs b/cli/tools/coverage/merge.rs
index 63b795f76..d995c6ab3 100644
--- a/cli/tools/coverage/merge.rs
+++ b/cli/tools/coverage/merge.rs
@@ -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 {
diff --git a/cli/tools/info.rs b/cli/tools/info.rs
index 6ab74360b..86a18c4e2 100644
--- a/cli/tools/info.rs
+++ b/cli/tools/info.rs
@@ -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()
diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs
index db49ed7a0..07397131c 100644
--- a/cli/tools/installer.rs
+++ b/cli/tools/installer.rs
@@ -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()))
diff --git a/cli/tools/vendor/mod.rs b/cli/tools/vendor/mod.rs
index 02261e34c..21e3a4485 100644
--- a/cli/tools/vendor/mod.rs
+++ b/cli/tools/vendor/mod.rs
@@ -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
diff --git a/cli/tools/vendor/test.rs b/cli/tools/vendor/test.rs
index c703357d8..9cf2bb603 100644
--- a/cli/tools/vendor/test.rs
+++ b/cli/tools/vendor/test.rs
@@ -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)
}
diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs
index 3751712f0..2b7b3d368 100644
--- a/cli/tsc/mod.rs
+++ b/cli/tsc/mod.rs
@@ -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(),
diff --git a/cli/util/fs.rs b/cli/util/fs.rs
index 40dfafdd8..cb8a4d369 100644
--- a/cli/util/fs.rs
+++ b/cli/util/fs.rs
@@ -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
diff --git a/cli/util/progress_bar/renderer.rs b/cli/util/progress_bar/renderer.rs
index cb249ce36..75a4cafed 100644
--- a/cli/util/progress_bar/renderer.rs
+++ b/cli/util/progress_bar/renderer.rs
@@ -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 {
diff --git a/core/module_specifier.rs b/core/module_specifier.rs
index 3f329f53f..4727ff2cb 100644
--- a/core/module_specifier.rs
+++ b/core/module_specifier.rs
@@ -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))
}
diff --git a/core/runtime.rs b/core/runtime.rs
index 3d37b13fa..a95ca0ca6 100644
--- a/core/runtime.rs
+++ b/core/runtime.rs
@@ -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()))
diff --git a/ext/cache/sqlite.rs b/ext/cache/sqlite.rs
index caf386777..f1314516f 100644
--- a/ext/cache/sqlite.rs
+++ b/ext/cache/sqlite.rs
@@ -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?
diff --git a/ext/ffi/callback.rs b/ext/ffi/callback.rs
index 9b759a30e..b63bb8eab 100644
--- a/ext/ffi/callback.rs
+++ b/ext/ffi/callback.rs
@@ -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 => {
diff --git a/ext/ffi/ir.rs b/ext/ffi/ir.rs
index 67c65b5b5..ee67171a4 100644
--- a/ext/ffi/ir.rs
+++ b/ext/ffi/ir.rs
@@ -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 })
}
diff --git a/ext/ffi/repr.rs b/ext/ffi/repr.rs
index 22cf03a6b..20b98154c 100644
--- a/ext/ffi/repr.rs
+++ b/ext/ffi/repr.rs
@@ -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]
diff --git a/ext/ffi/turbocall.rs b/ext/ffi/turbocall.rs
index 79ec814b4..bbe29238a 100644
--- a/ext/ffi/turbocall.rs
+++ b/ext/ffi/turbocall.rs
@@ -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!(
diff --git a/ext/node/resolution.rs b/ext/node/resolution.rs
index 10f085070..cd9496ad4 100644
--- a/ext/node/resolution.rs
+++ b/ext/node/resolution.rs
@@ -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()
diff --git a/ext/web/timers.rs b/ext/web/timers.rs
index 5b1310792..6026b7c3b 100644
--- a/ext/web/timers.rs
+++ b/ext/web/timers.rs
@@ -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>);
diff --git a/runtime/fs_util.rs b/runtime/fs_util.rs
index 30598e041..a71e70986 100644
--- a/runtime/fs_util.rs
+++ b/runtime/fs_util.rs
@@ -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)))
}
}
diff --git a/runtime/ops/fs.rs b/runtime/ops/fs.rs
index ec60eed62..b9f637448 100644
--- a/runtime/ops/fs.rs
+++ b/runtime/ops/fs.rs
@@ -525,7 +525,14 @@ fn op_umask(state: &mut OpState, mask: Option<u32>) -> Result<u32, AnyError> {
let _ = umask(prev);
prev
};
- Ok(r.bits() as u32)
+ #[cfg(target_os = "linux")]
+ {
+ Ok(r.bits())
+ }
+ #[cfg(target_os = "macos")]
+ {
+ Ok(r.bits() as u32)
+ }
}
}
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index c032b5730..d1df584a7 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,3 +1,3 @@
[toolchain]
-channel = "1.65.0"
+channel = "1.66.0"
components = ["rustfmt", "clippy"]
diff --git a/serde_v8/de.rs b/serde_v8/de.rs
index a43a9c177..300b047b7 100644
--- a/serde_v8/de.rs
+++ b/serde_v8/de.rs
@@ -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 {