diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af888ff09e..8413e2f8ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,7 +84,7 @@ jobs: - name: Install Rust uses: hecrj/setup-rust-action@v1 with: - rust-version: 1.56.1 + rust-version: 1.57.0 - name: Install clippy and rustfmt if: matrix.job == 'lint' diff --git a/bench_util/src/profiling.rs b/bench_util/src/profiling.rs index aad9f0159a..b4459ad60a 100644 --- a/bench_util/src/profiling.rs +++ b/bench_util/src/profiling.rs @@ -54,7 +54,7 @@ fn run_profile(test: TestDescAndFn) { bencher::bench::run_once(|harness| bencher.run(harness)); } StaticBenchFn(benchfn) => { - bencher::bench::run_once(|harness| benchfn(harness)); + bencher::bench::run_once(benchfn); } }; } diff --git a/cli/lsp/mod.rs b/cli/lsp/mod.rs index 27795e698c..bbfb757dc7 100644 --- a/cli/lsp/mod.rs +++ b/cli/lsp/mod.rs @@ -1,5 +1,8 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// FIXME(bartlomieju): remove this attribute +#![allow(unused)] + use deno_core::error::AnyError; use lspower::LspService; use lspower::Server; diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index a426fea0f2..252939f851 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -137,7 +137,7 @@ pub fn infer_name_from_url(url: &Url) -> Option { stem = parent_name.to_string_lossy().to_string(); } } - let stem = stem.splitn(2, '@').next().unwrap().to_string(); + let stem = stem.split_once('@').map_or(&*stem, |x| x.0).to_string(); Some(stem) } diff --git a/core/async_cancel.rs b/core/async_cancel.rs index ab7ec22483..1cdddcdb53 100644 --- a/core/async_cancel.rs +++ b/core/async_cancel.rs @@ -511,7 +511,7 @@ mod internal { /// the heap allocation that contains the `CancelHandle`. Without this /// extra weak reference, `Rc::get_mut()` might succeed and allow the /// `CancelHandle` to be moved when it isn't safe to do so. - weak_pin: Weak, + _weak_pin: Weak, }, /// All item nodes in a chain are associated with a `Cancelable` head node. Item { @@ -523,8 +523,8 @@ mod internal { impl NodeKind { fn head(rc_pin: &Rc) -> Self { - let weak_pin = Rc::downgrade(rc_pin); - Self::Head { weak_pin } + let _weak_pin = Rc::downgrade(rc_pin); + Self::Head { _weak_pin } } fn item(waker: &Waker) -> Self { diff --git a/core/modules.rs b/core/modules.rs index bc3885a7be..067ee48e37 100644 --- a/core/modules.rs +++ b/core/modules.rs @@ -1487,7 +1487,7 @@ mod tests { #[test] fn slow_never_ready_modules() { - run_in_task(|mut cx| { + run_in_task(|cx| { let loader = MockLoader::new(); let loads = loader.loads.clone(); let mut runtime = JsRuntime::new(RuntimeOptions { @@ -1498,7 +1498,7 @@ mod tests { let mut recursive_load = runtime.load_main_module(&spec, None).boxed_local(); - let result = recursive_load.poll_unpin(&mut cx); + let result = recursive_load.poll_unpin(cx); assert!(result.is_pending()); // TODO(ry) Arguably the first time we poll only the following modules @@ -1511,7 +1511,7 @@ mod tests { // run_in_task. for _ in 0..10 { - let result = recursive_load.poll_unpin(&mut cx); + let result = recursive_load.poll_unpin(cx); assert!(result.is_pending()); let l = loads.lock(); assert_eq!( @@ -1537,7 +1537,7 @@ mod tests { #[test] fn loader_disappears_after_error() { - run_in_task(|mut cx| { + run_in_task(|cx| { let loader = MockLoader::new(); let mut runtime = JsRuntime::new(RuntimeOptions { module_loader: Some(loader), @@ -1545,7 +1545,7 @@ mod tests { }); let spec = crate::resolve_url("file:///bad_import.js").unwrap(); let mut load_fut = runtime.load_main_module(&spec, None).boxed_local(); - let result = load_fut.poll_unpin(&mut cx); + let result = load_fut.poll_unpin(cx); if let Poll::Ready(Err(err)) = result { assert_eq!( err.downcast_ref::().unwrap(), diff --git a/core/runtime.rs b/core/runtime.rs index 5db11d9c5a..15bb103ba1 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -1950,7 +1950,7 @@ pub mod tests { #[test] fn test_pre_dispatch() { - run_in_task(|mut cx| { + run_in_task(|cx| { let (mut runtime, _dispatch_count) = setup(Mode::Async); runtime .execute_script( @@ -1966,7 +1966,7 @@ pub mod tests { "#, ) .unwrap(); - if let Poll::Ready(Err(_)) = runtime.poll_event_loop(&mut cx, false) { + if let Poll::Ready(Err(_)) = runtime.poll_event_loop(cx, false) { unreachable!(); } }); @@ -1984,7 +1984,7 @@ pub mod tests { #[test] fn test_encode_decode() { - run_in_task(|mut cx| { + run_in_task(|cx| { let (mut runtime, _dispatch_count) = setup(Mode::Async); runtime .execute_script( @@ -1992,7 +1992,7 @@ pub mod tests { include_str!("encode_decode_test.js"), ) .unwrap(); - if let Poll::Ready(Err(_)) = runtime.poll_event_loop(&mut cx, false) { + if let Poll::Ready(Err(_)) = runtime.poll_event_loop(cx, false) { unreachable!(); } }); @@ -2000,7 +2000,7 @@ pub mod tests { #[test] fn test_serialize_deserialize() { - run_in_task(|mut cx| { + run_in_task(|cx| { let (mut runtime, _dispatch_count) = setup(Mode::Async); runtime .execute_script( @@ -2008,7 +2008,7 @@ pub mod tests { include_str!("serialize_deserialize_test.js"), ) .unwrap(); - if let Poll::Ready(Err(_)) = runtime.poll_event_loop(&mut cx, false) { + if let Poll::Ready(Err(_)) = runtime.poll_event_loop(cx, false) { unreachable!(); } }); @@ -2024,7 +2024,7 @@ pub mod tests { "DOMExceptionOperationError" } - run_in_task(|mut cx| { + run_in_task(|cx| { let mut runtime = JsRuntime::new(RuntimeOptions { get_error_class_fn: Some(&get_error_class_name), ..Default::default() @@ -2037,7 +2037,7 @@ pub mod tests { include_str!("error_builder_test.js"), ) .unwrap(); - if let Poll::Ready(Err(_)) = runtime.poll_event_loop(&mut cx, false) { + if let Poll::Ready(Err(_)) = runtime.poll_event_loop(cx, false) { unreachable!(); } }); diff --git a/ext/net/ops_tls.rs b/ext/net/ops_tls.rs index 67e6dfc167..3de5d84766 100644 --- a/ext/net/ops_tls.rs +++ b/ext/net/ops_tls.rs @@ -665,7 +665,7 @@ impl Shared { self_arc.rd_waker.wake(); self_arc.wr_waker.wake(); } - self_weak.into_raw(); + let _ = self_weak.into_raw(); } fn drop_shared_waker(self_ptr: *const ()) { diff --git a/runtime/ops/permissions.rs b/runtime/ops/permissions.rs index 05f4b75d7c..d8005a743e 100644 --- a/runtime/ops/permissions.rs +++ b/runtime/ops/permissions.rs @@ -38,8 +38,8 @@ pub fn op_query_permission( let permissions = state.borrow::(); let path = args.path.as_deref(); let perm = match args.name.as_ref() { - "read" => permissions.read.query(path.as_deref().map(Path::new)), - "write" => permissions.write.query(path.as_deref().map(Path::new)), + "read" => permissions.read.query(path.map(Path::new)), + "write" => permissions.write.query(path.map(Path::new)), "net" => permissions.net.query( match args.host.as_deref() { None => None, @@ -69,8 +69,8 @@ pub fn op_revoke_permission( let permissions = state.borrow_mut::(); let path = args.path.as_deref(); let perm = match args.name.as_ref() { - "read" => permissions.read.revoke(path.as_deref().map(Path::new)), - "write" => permissions.write.revoke(path.as_deref().map(Path::new)), + "read" => permissions.read.revoke(path.map(Path::new)), + "write" => permissions.write.revoke(path.map(Path::new)), "net" => permissions.net.revoke( match args.host.as_deref() { None => None, @@ -100,8 +100,8 @@ pub fn op_request_permission( let permissions = state.borrow_mut::(); let path = args.path.as_deref(); let perm = match args.name.as_ref() { - "read" => permissions.read.request(path.as_deref().map(Path::new)), - "write" => permissions.write.request(path.as_deref().map(Path::new)), + "read" => permissions.read.request(path.map(Path::new)), + "write" => permissions.write.request(path.map(Path::new)), "net" => permissions.net.request( match args.host.as_deref() { None => None, diff --git a/serde_v8/examples/basic.rs b/serde_v8/examples/basic.rs index 8bea43bb50..ee5e28fe6a 100644 --- a/serde_v8/examples/basic.rs +++ b/serde_v8/examples/basic.rs @@ -34,7 +34,10 @@ fn main() { let v = exec(scope, "({a: 1, b: 3, c: 'ignored'})"); let mop: MathOp = serde_v8::from_v8(scope, v).unwrap(); - println!("mop = {:?}", mop); + println!( + "mop = {{ a: {}, b: {}, operator: {:?} }}", + mop.a, mop.b, mop.operator + ); let v = exec(scope, "[1,2,3,4,5]"); let arr: Vec = serde_v8::from_v8(scope, v).unwrap(); diff --git a/serde_v8/src/de.rs b/serde_v8/src/de.rs index f803ab3812..44f94b2d6e 100644 --- a/serde_v8/src/de.rs +++ b/serde_v8/src/de.rs @@ -165,14 +165,14 @@ impl<'de, 'a, 'b, 's, 'x> de::Deserializer<'de> where V: Visitor<'de>, { - visitor.visit_f32(self.input.number_value(&mut self.scope).unwrap() as f32) + visitor.visit_f32(self.input.number_value(self.scope).unwrap() as f32) } fn deserialize_f64(self, visitor: V) -> Result where V: Visitor<'de>, { - visitor.visit_f64(self.input.number_value(&mut self.scope).unwrap()) + visitor.visit_f64(self.input.number_value(self.scope).unwrap()) } wip!(deserialize_char);