summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--bench_util/src/profiling.rs2
-rw-r--r--cli/lsp/mod.rs3
-rw-r--r--cli/tools/installer.rs2
-rw-r--r--core/async_cancel.rs6
-rw-r--r--core/modules.rs10
-rw-r--r--core/runtime.rs16
-rw-r--r--ext/net/ops_tls.rs2
-rw-r--r--runtime/ops/permissions.rs12
-rw-r--r--serde_v8/examples/basic.rs5
-rw-r--r--serde_v8/src/de.rs4
11 files changed, 35 insertions, 29 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index af888ff09..8413e2f8e 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 aad9f0159..b4459ad60 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 27795e698..bbfb757dc 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 a426fea0f..252939f85 100644
--- a/cli/tools/installer.rs
+++ b/cli/tools/installer.rs
@@ -137,7 +137,7 @@ pub fn infer_name_from_url(url: &Url) -> Option<String> {
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 ab7ec2248..1cdddcdb5 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<dyn Any>,
+ _weak_pin: Weak<dyn Any>,
},
/// 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<dyn Any>) -> 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 bc3885a7b..067ee48e3 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::<MockError>().unwrap(),
diff --git a/core/runtime.rs b/core/runtime.rs
index 5db11d9c5..15bb103ba 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 67e6dfc16..3de5d8476 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 05f4b75d7..d8005a743 100644
--- a/runtime/ops/permissions.rs
+++ b/runtime/ops/permissions.rs
@@ -38,8 +38,8 @@ pub fn op_query_permission(
let permissions = state.borrow::<Permissions>();
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::<Permissions>();
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::<Permissions>();
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 8bea43bb5..ee5e28fe6 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<u64> = serde_v8::from_v8(scope, v).unwrap();
diff --git a/serde_v8/src/de.rs b/serde_v8/src/de.rs
index f803ab381..44f94b2d6 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<V>(self, visitor: V) -> Result<V::Value>
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);