1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-30 16:40:57 -05:00

chore: use Rust 1.63.0 (#15464)

This commit is contained in:
Mathias Lafeldt 2022-08-21 19:31:14 +02:00 committed by GitHub
parent fb2aeb79a1
commit e96933bc16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 26 additions and 15 deletions

View file

@ -23,4 +23,6 @@ rustflags = [
"clippy::missing_safety_doc", "clippy::missing_safety_doc",
"-D", "-D",
"clippy::undocumented_unsafe_blocks", "clippy::undocumented_unsafe_blocks",
"-A",
"clippy::derive-partial-eq-without-eq",
] ]

View file

@ -1070,9 +1070,7 @@ pub fn main() {
logger::init(flags.log_level); logger::init(flags.log_level);
let exit_code = get_subcommand(flags).await; get_subcommand(flags).await
exit_code
}; };
let exit_code = unwrap_or_exit(run_local(exit_code)); let exit_code = unwrap_or_exit(run_local(exit_code));

View file

@ -752,7 +752,7 @@ fn extract_files_from_regex_blocks(
return None; return None;
} }
match attributes.get(0) { match attributes.first() {
Some(&"js") => MediaType::JavaScript, Some(&"js") => MediaType::JavaScript,
Some(&"javascript") => MediaType::JavaScript, Some(&"javascript") => MediaType::JavaScript,
Some(&"mjs") => MediaType::Mjs, Some(&"mjs") => MediaType::Mjs,

View file

@ -219,7 +219,7 @@ mod internal {
// Do a cancellation check _before_ polling the inner future. If it has // Do a cancellation check _before_ polling the inner future. If it has
// already been canceled the inner future will not be polled. // already been canceled the inner future will not be polled.
let node = match &*registration { let node = match &*registration {
Registration::WillRegister { head_node } => &*head_node, Registration::WillRegister { head_node } => head_node,
Registration::Registered { node } => node, Registration::Registered { node } => node,
}; };
if node.is_canceled() { if node.is_canceled() {

View file

@ -438,6 +438,7 @@ struct InspectorWakerInner {
isolate_handle: v8::IsolateHandle, isolate_handle: v8::IsolateHandle,
} }
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Send for InspectorWakerInner {} unsafe impl Send for InspectorWakerInner {}
struct InspectorWaker(Mutex<InspectorWakerInner>); struct InspectorWaker(Mutex<InspectorWakerInner>);

View file

@ -1346,7 +1346,7 @@ import "/a.js";
Err(..) => return Err(MockError::ResolveErr.into()), Err(..) => return Err(MockError::ResolveErr.into()),
}; };
if mock_source_code(&output_specifier.to_string()).is_some() { if mock_source_code(output_specifier.as_ref()).is_some() {
Ok(output_specifier) Ok(output_specifier)
} else { } else {
Err(MockError::ResolveErr.into()) Err(MockError::ResolveErr.into())

View file

@ -673,6 +673,7 @@ fn op_set_wasm_streaming_callback(
Ok(()) Ok(())
} }
#[allow(clippy::let_and_return)]
#[op(v8)] #[op(v8)]
fn op_abort_wasm_streaming( fn op_abort_wasm_streaming(
scope: &mut v8::HandleScope, scope: &mut v8::HandleScope,

View file

@ -97,7 +97,9 @@ struct Symbol {
} }
#[allow(clippy::non_send_fields_in_send_ty)] #[allow(clippy::non_send_fields_in_send_ty)]
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Send for Symbol {} unsafe impl Send for Symbol {}
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Sync for Symbol {} unsafe impl Sync for Symbol {}
#[derive(Clone)] #[derive(Clone)]
@ -123,7 +125,9 @@ impl PtrSymbol {
} }
#[allow(clippy::non_send_fields_in_send_ty)] #[allow(clippy::non_send_fields_in_send_ty)]
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Send for PtrSymbol {} unsafe impl Send for PtrSymbol {}
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Sync for PtrSymbol {} unsafe impl Sync for PtrSymbol {}
struct DynamicLibraryResource { struct DynamicLibraryResource {
@ -363,7 +367,7 @@ impl NativeValue {
} }
NativeType::ISize => { NativeType::ISize => {
let value = self.isize_value; let value = self.isize_value;
if value > MAX_SAFE_INTEGER || value < MIN_SAFE_INTEGER { if !(MIN_SAFE_INTEGER..=MAX_SAFE_INTEGER).contains(&value) {
json!(U32x2::from(self.isize_value as u64)) json!(U32x2::from(self.isize_value as u64))
} else { } else {
Value::from(value) Value::from(value)
@ -458,7 +462,7 @@ impl NativeValue {
NativeType::ISize => { NativeType::ISize => {
let value = self.isize_value; let value = self.isize_value;
let local_value: v8::Local<v8::Value> = let local_value: v8::Local<v8::Value> =
if value > MAX_SAFE_INTEGER || value < MIN_SAFE_INTEGER { if !(MIN_SAFE_INTEGER..=MAX_SAFE_INTEGER).contains(&value) {
v8::BigInt::new_from_i64(scope, self.isize_value as i64).into() v8::BigInt::new_from_i64(scope, self.isize_value as i64).into()
} else { } else {
v8::Number::new(scope, value as f64).into() v8::Number::new(scope, value as f64).into()
@ -489,6 +493,7 @@ impl NativeValue {
} }
} }
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Send for NativeValue {} unsafe impl Send for NativeValue {}
#[derive(Serialize, Debug, Clone, Copy)] #[derive(Serialize, Debug, Clone, Copy)]
@ -1979,7 +1984,7 @@ fn op_ffi_get_static<'scope>(
// SAFETY: ptr is user provided // SAFETY: ptr is user provided
let result = unsafe { ptr::read_unaligned(data_ptr as *const isize) }; let result = unsafe { ptr::read_unaligned(data_ptr as *const isize) };
let integer: v8::Local<v8::Value> = let integer: v8::Local<v8::Value> =
if result > MAX_SAFE_INTEGER || result < MIN_SAFE_INTEGER { if !(MIN_SAFE_INTEGER..=MAX_SAFE_INTEGER).contains(&result) {
v8::BigInt::new_from_i64(scope, result as i64).into() v8::BigInt::new_from_i64(scope, result as i64).into()
} else { } else {
v8::Number::new(scope, result as f64).into() v8::Number::new(scope, result as f64).into()

View file

@ -136,6 +136,7 @@ impl TcpStreamResource {
.map_socket(Box::new(move |socket| Ok(socket.set_keepalive(keepalive)?))) .map_socket(Box::new(move |socket| Ok(socket.set_keepalive(keepalive)?)))
} }
#[allow(clippy::type_complexity)]
fn map_socket( fn map_socket(
self: Rc<Self>, self: Rc<Self>,
map: Box<dyn FnOnce(SockRef) -> Result<(), AnyError>>, map: Box<dyn FnOnce(SockRef) -> Result<(), AnyError>>,

View file

@ -1047,6 +1047,7 @@ mod tests {
check_sockopt(String::from("127.0.0.1:4246"), set_keepalive, test_fn).await; check_sockopt(String::from("127.0.0.1:4246"), set_keepalive, test_fn).await;
} }
#[allow(clippy::type_complexity)]
async fn check_sockopt( async fn check_sockopt(
addr: String, addr: String,
set_sockopt_fn: Box<dyn Fn(&mut OpState, u32)>, set_sockopt_fn: Box<dyn Fn(&mut OpState, u32)>,

View file

@ -1,3 +1,3 @@
[toolchain] [toolchain]
channel = "1.62.1" channel = "1.63.0"
components = ["rustfmt", "clippy"] components = ["rustfmt", "clippy"]

View file

@ -58,7 +58,7 @@ impl Clone for ZeroCopyBuf {
impl AsRef<[u8]> for ZeroCopyBuf { impl AsRef<[u8]> for ZeroCopyBuf {
fn as_ref(&self) -> &[u8] { fn as_ref(&self) -> &[u8] {
&*self self
} }
} }
@ -72,8 +72,8 @@ impl Deref for ZeroCopyBuf {
type Target = [u8]; type Target = [u8];
fn deref(&self) -> &[u8] { fn deref(&self) -> &[u8] {
match self { match self {
Self::FromV8(buf) => &*buf, Self::FromV8(buf) => buf,
Self::Temp(vec) => &*vec, Self::Temp(vec) => vec,
Self::ToV8(_) => panic!("Don't Deref a ZeroCopyBuf sent to v8"), Self::ToV8(_) => panic!("Don't Deref a ZeroCopyBuf sent to v8"),
} }
} }

View file

@ -25,6 +25,7 @@ pub struct V8Slice {
pub(crate) range: Range<usize>, pub(crate) range: Range<usize>,
} }
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Send for V8Slice {} unsafe impl Send for V8Slice {}
impl V8Slice { impl V8Slice {

View file

@ -39,7 +39,7 @@ impl SerializablePkg {
&self, &self,
scope: &mut v8::HandleScope<'a>, scope: &mut v8::HandleScope<'a>,
) -> Result<v8::Local<'a, v8::Value>, crate::Error> { ) -> Result<v8::Local<'a, v8::Value>, crate::Error> {
match &*self { match self {
Self::Primitive(x) => crate::to_v8(scope, x), Self::Primitive(x) => crate::to_v8(scope, x),
Self::Serializable(x) => x.to_v8(scope), Self::Serializable(x) => x.to_v8(scope),
} }

View file

@ -1052,6 +1052,7 @@ impl hyper::server::accept::Accept for HyperAcceptor<'_> {
} }
#[allow(clippy::non_send_fields_in_send_ty)] #[allow(clippy::non_send_fields_in_send_ty)]
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl std::marker::Send for HyperAcceptor<'_> {} unsafe impl std::marker::Send for HyperAcceptor<'_> {}
async fn wrap_redirect_server() { async fn wrap_redirect_server() {
@ -1897,7 +1898,7 @@ impl<'a> CheckOutputIntegrationTest<'a> {
// deno test's output capturing flushes with a zero-width space in order to // deno test's output capturing flushes with a zero-width space in order to
// synchronize the output pipes. Occassionally this zero width space // synchronize the output pipes. Occassionally this zero width space
// might end up in the output so strip it from the output comparison here. // might end up in the output so strip it from the output comparison here.
if args.get(0) == Some(&"test") { if args.first() == Some(&"test") {
actual = actual.replace('\u{200B}', ""); actual = actual.replace('\u{200B}', "");
} }