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

chore: upgrade to Rust 1.57.0 (#12968)

This commit is contained in:
Bartek Iwańczuk 2021-12-04 14:19:06 +01:00 committed by GitHub
parent 72e9720e91
commit c59f90d01f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 35 additions and 29 deletions

View file

@ -84,7 +84,7 @@ jobs:
- name: Install Rust - name: Install Rust
uses: hecrj/setup-rust-action@v1 uses: hecrj/setup-rust-action@v1
with: with:
rust-version: 1.56.1 rust-version: 1.57.0
- name: Install clippy and rustfmt - name: Install clippy and rustfmt
if: matrix.job == 'lint' if: matrix.job == 'lint'

View file

@ -54,7 +54,7 @@ fn run_profile(test: TestDescAndFn) {
bencher::bench::run_once(|harness| bencher.run(harness)); bencher::bench::run_once(|harness| bencher.run(harness));
} }
StaticBenchFn(benchfn) => { StaticBenchFn(benchfn) => {
bencher::bench::run_once(|harness| benchfn(harness)); bencher::bench::run_once(benchfn);
} }
}; };
} }

View file

@ -1,5 +1,8 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// FIXME(bartlomieju): remove this attribute
#![allow(unused)]
use deno_core::error::AnyError; use deno_core::error::AnyError;
use lspower::LspService; use lspower::LspService;
use lspower::Server; use lspower::Server;

View file

@ -137,7 +137,7 @@ pub fn infer_name_from_url(url: &Url) -> Option<String> {
stem = parent_name.to_string_lossy().to_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) Some(stem)
} }

View file

@ -511,7 +511,7 @@ mod internal {
/// the heap allocation that contains the `CancelHandle`. Without this /// the heap allocation that contains the `CancelHandle`. Without this
/// extra weak reference, `Rc::get_mut()` might succeed and allow the /// extra weak reference, `Rc::get_mut()` might succeed and allow the
/// `CancelHandle` to be moved when it isn't safe to do so. /// `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. /// All item nodes in a chain are associated with a `Cancelable` head node.
Item { Item {
@ -523,8 +523,8 @@ mod internal {
impl NodeKind { impl NodeKind {
fn head(rc_pin: &Rc<dyn Any>) -> Self { fn head(rc_pin: &Rc<dyn Any>) -> Self {
let weak_pin = Rc::downgrade(rc_pin); let _weak_pin = Rc::downgrade(rc_pin);
Self::Head { weak_pin } Self::Head { _weak_pin }
} }
fn item(waker: &Waker) -> Self { fn item(waker: &Waker) -> Self {

View file

@ -1487,7 +1487,7 @@ mod tests {
#[test] #[test]
fn slow_never_ready_modules() { fn slow_never_ready_modules() {
run_in_task(|mut cx| { run_in_task(|cx| {
let loader = MockLoader::new(); let loader = MockLoader::new();
let loads = loader.loads.clone(); let loads = loader.loads.clone();
let mut runtime = JsRuntime::new(RuntimeOptions { let mut runtime = JsRuntime::new(RuntimeOptions {
@ -1498,7 +1498,7 @@ mod tests {
let mut recursive_load = let mut recursive_load =
runtime.load_main_module(&spec, None).boxed_local(); 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()); assert!(result.is_pending());
// TODO(ry) Arguably the first time we poll only the following modules // TODO(ry) Arguably the first time we poll only the following modules
@ -1511,7 +1511,7 @@ mod tests {
// run_in_task. // run_in_task.
for _ in 0..10 { for _ in 0..10 {
let result = recursive_load.poll_unpin(&mut cx); let result = recursive_load.poll_unpin(cx);
assert!(result.is_pending()); assert!(result.is_pending());
let l = loads.lock(); let l = loads.lock();
assert_eq!( assert_eq!(
@ -1537,7 +1537,7 @@ mod tests {
#[test] #[test]
fn loader_disappears_after_error() { fn loader_disappears_after_error() {
run_in_task(|mut cx| { run_in_task(|cx| {
let loader = MockLoader::new(); let loader = MockLoader::new();
let mut runtime = JsRuntime::new(RuntimeOptions { let mut runtime = JsRuntime::new(RuntimeOptions {
module_loader: Some(loader), module_loader: Some(loader),
@ -1545,7 +1545,7 @@ mod tests {
}); });
let spec = crate::resolve_url("file:///bad_import.js").unwrap(); let spec = crate::resolve_url("file:///bad_import.js").unwrap();
let mut load_fut = runtime.load_main_module(&spec, None).boxed_local(); 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 { if let Poll::Ready(Err(err)) = result {
assert_eq!( assert_eq!(
err.downcast_ref::<MockError>().unwrap(), err.downcast_ref::<MockError>().unwrap(),

View file

@ -1950,7 +1950,7 @@ pub mod tests {
#[test] #[test]
fn test_pre_dispatch() { fn test_pre_dispatch() {
run_in_task(|mut cx| { run_in_task(|cx| {
let (mut runtime, _dispatch_count) = setup(Mode::Async); let (mut runtime, _dispatch_count) = setup(Mode::Async);
runtime runtime
.execute_script( .execute_script(
@ -1966,7 +1966,7 @@ pub mod tests {
"#, "#,
) )
.unwrap(); .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!(); unreachable!();
} }
}); });
@ -1984,7 +1984,7 @@ pub mod tests {
#[test] #[test]
fn test_encode_decode() { fn test_encode_decode() {
run_in_task(|mut cx| { run_in_task(|cx| {
let (mut runtime, _dispatch_count) = setup(Mode::Async); let (mut runtime, _dispatch_count) = setup(Mode::Async);
runtime runtime
.execute_script( .execute_script(
@ -1992,7 +1992,7 @@ pub mod tests {
include_str!("encode_decode_test.js"), include_str!("encode_decode_test.js"),
) )
.unwrap(); .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!(); unreachable!();
} }
}); });
@ -2000,7 +2000,7 @@ pub mod tests {
#[test] #[test]
fn test_serialize_deserialize() { fn test_serialize_deserialize() {
run_in_task(|mut cx| { run_in_task(|cx| {
let (mut runtime, _dispatch_count) = setup(Mode::Async); let (mut runtime, _dispatch_count) = setup(Mode::Async);
runtime runtime
.execute_script( .execute_script(
@ -2008,7 +2008,7 @@ pub mod tests {
include_str!("serialize_deserialize_test.js"), include_str!("serialize_deserialize_test.js"),
) )
.unwrap(); .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!(); unreachable!();
} }
}); });
@ -2024,7 +2024,7 @@ pub mod tests {
"DOMExceptionOperationError" "DOMExceptionOperationError"
} }
run_in_task(|mut cx| { run_in_task(|cx| {
let mut runtime = JsRuntime::new(RuntimeOptions { let mut runtime = JsRuntime::new(RuntimeOptions {
get_error_class_fn: Some(&get_error_class_name), get_error_class_fn: Some(&get_error_class_name),
..Default::default() ..Default::default()
@ -2037,7 +2037,7 @@ pub mod tests {
include_str!("error_builder_test.js"), include_str!("error_builder_test.js"),
) )
.unwrap(); .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!(); unreachable!();
} }
}); });

View file

@ -665,7 +665,7 @@ impl Shared {
self_arc.rd_waker.wake(); self_arc.rd_waker.wake();
self_arc.wr_waker.wake(); self_arc.wr_waker.wake();
} }
self_weak.into_raw(); let _ = self_weak.into_raw();
} }
fn drop_shared_waker(self_ptr: *const ()) { fn drop_shared_waker(self_ptr: *const ()) {

View file

@ -38,8 +38,8 @@ pub fn op_query_permission(
let permissions = state.borrow::<Permissions>(); let permissions = state.borrow::<Permissions>();
let path = args.path.as_deref(); let path = args.path.as_deref();
let perm = match args.name.as_ref() { let perm = match args.name.as_ref() {
"read" => permissions.read.query(path.as_deref().map(Path::new)), "read" => permissions.read.query(path.map(Path::new)),
"write" => permissions.write.query(path.as_deref().map(Path::new)), "write" => permissions.write.query(path.map(Path::new)),
"net" => permissions.net.query( "net" => permissions.net.query(
match args.host.as_deref() { match args.host.as_deref() {
None => None, None => None,
@ -69,8 +69,8 @@ pub fn op_revoke_permission(
let permissions = state.borrow_mut::<Permissions>(); let permissions = state.borrow_mut::<Permissions>();
let path = args.path.as_deref(); let path = args.path.as_deref();
let perm = match args.name.as_ref() { let perm = match args.name.as_ref() {
"read" => permissions.read.revoke(path.as_deref().map(Path::new)), "read" => permissions.read.revoke(path.map(Path::new)),
"write" => permissions.write.revoke(path.as_deref().map(Path::new)), "write" => permissions.write.revoke(path.map(Path::new)),
"net" => permissions.net.revoke( "net" => permissions.net.revoke(
match args.host.as_deref() { match args.host.as_deref() {
None => None, None => None,
@ -100,8 +100,8 @@ pub fn op_request_permission(
let permissions = state.borrow_mut::<Permissions>(); let permissions = state.borrow_mut::<Permissions>();
let path = args.path.as_deref(); let path = args.path.as_deref();
let perm = match args.name.as_ref() { let perm = match args.name.as_ref() {
"read" => permissions.read.request(path.as_deref().map(Path::new)), "read" => permissions.read.request(path.map(Path::new)),
"write" => permissions.write.request(path.as_deref().map(Path::new)), "write" => permissions.write.request(path.map(Path::new)),
"net" => permissions.net.request( "net" => permissions.net.request(
match args.host.as_deref() { match args.host.as_deref() {
None => None, None => None,

View file

@ -34,7 +34,10 @@ fn main() {
let v = exec(scope, "({a: 1, b: 3, c: 'ignored'})"); let v = exec(scope, "({a: 1, b: 3, c: 'ignored'})");
let mop: MathOp = serde_v8::from_v8(scope, v).unwrap(); 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 v = exec(scope, "[1,2,3,4,5]");
let arr: Vec<u64> = serde_v8::from_v8(scope, v).unwrap(); let arr: Vec<u64> = serde_v8::from_v8(scope, v).unwrap();

View file

@ -165,14 +165,14 @@ impl<'de, 'a, 'b, 's, 'x> de::Deserializer<'de>
where where
V: Visitor<'de>, 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> fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value>
where where
V: Visitor<'de>, 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); wip!(deserialize_char);