Skip to content

Commit

Permalink
chore: use Rust 1.63.0 (denoland#15464)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlafeldt committed Aug 21, 2022
1 parent fb2aeb7 commit e96933b
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ rustflags = [
"clippy::missing_safety_doc",
"-D",
"clippy::undocumented_unsafe_blocks",
"-A",
"clippy::derive-partial-eq-without-eq",
]
4 changes: 1 addition & 3 deletions cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,9 +1070,7 @@ pub fn main() {

logger::init(flags.log_level);

let exit_code = get_subcommand(flags).await;

exit_code
get_subcommand(flags).await
};

let exit_code = unwrap_or_exit(run_local(exit_code));
Expand Down
2 changes: 1 addition & 1 deletion cli/tools/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ fn extract_files_from_regex_blocks(
return None;
}

match attributes.get(0) {
match attributes.first() {
Some(&"js") => MediaType::JavaScript,
Some(&"javascript") => MediaType::JavaScript,
Some(&"mjs") => MediaType::Mjs,
Expand Down
2 changes: 1 addition & 1 deletion core/async_cancel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ mod internal {
// Do a cancellation check _before_ polling the inner future. If it has
// already been canceled the inner future will not be polled.
let node = match &*registration {
Registration::WillRegister { head_node } => &*head_node,
Registration::WillRegister { head_node } => head_node,
Registration::Registered { node } => node,
};
if node.is_canceled() {
Expand Down
1 change: 1 addition & 0 deletions core/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ struct InspectorWakerInner {
isolate_handle: v8::IsolateHandle,
}

// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Send for InspectorWakerInner {}

struct InspectorWaker(Mutex<InspectorWakerInner>);
Expand Down
2 changes: 1 addition & 1 deletion core/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ import "/a.js";
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)
} else {
Err(MockError::ResolveErr.into())
Expand Down
1 change: 1 addition & 0 deletions core/ops_builtin_v8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ fn op_set_wasm_streaming_callback(
Ok(())
}

#[allow(clippy::let_and_return)]
#[op(v8)]
fn op_abort_wasm_streaming(
scope: &mut v8::HandleScope,
Expand Down
11 changes: 8 additions & 3 deletions ext/ffi/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ struct Symbol {
}

#[allow(clippy::non_send_fields_in_send_ty)]
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Send for Symbol {}
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Sync for Symbol {}

#[derive(Clone)]
Expand All @@ -123,7 +125,9 @@ impl PtrSymbol {
}

#[allow(clippy::non_send_fields_in_send_ty)]
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Send for PtrSymbol {}
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Sync for PtrSymbol {}

struct DynamicLibraryResource {
Expand Down Expand Up @@ -363,7 +367,7 @@ impl NativeValue {
}
NativeType::ISize => {
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))
} else {
Value::from(value)
Expand Down Expand Up @@ -458,7 +462,7 @@ impl NativeValue {
NativeType::ISize => {
let value = self.isize_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()
} else {
v8::Number::new(scope, value as f64).into()
Expand Down Expand Up @@ -489,6 +493,7 @@ impl NativeValue {
}
}

// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Send for NativeValue {}

#[derive(Serialize, Debug, Clone, Copy)]
Expand Down Expand Up @@ -1979,7 +1984,7 @@ fn op_ffi_get_static<'scope>(
// SAFETY: ptr is user provided
let result = unsafe { ptr::read_unaligned(data_ptr as *const isize) };
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()
} else {
v8::Number::new(scope, result as f64).into()
Expand Down
1 change: 1 addition & 0 deletions ext/net/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ impl TcpStreamResource {
.map_socket(Box::new(move |socket| Ok(socket.set_keepalive(keepalive)?)))
}

#[allow(clippy::type_complexity)]
fn map_socket(
self: Rc<Self>,
map: Box<dyn FnOnce(SockRef) -> Result<(), AnyError>>,
Expand Down
1 change: 1 addition & 0 deletions ext/net/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ mod tests {
check_sockopt(String::from("127.0.0.1:4246"), set_keepalive, test_fn).await;
}

#[allow(clippy::type_complexity)]
async fn check_sockopt(
addr: String,
set_sockopt_fn: Box<dyn Fn(&mut OpState, u32)>,
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.62.1"
channel = "1.63.0"
components = ["rustfmt", "clippy"]
6 changes: 3 additions & 3 deletions serde_v8/magic/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Clone for ZeroCopyBuf {

impl AsRef<[u8]> for ZeroCopyBuf {
fn as_ref(&self) -> &[u8] {
&*self
self
}
}

Expand All @@ -72,8 +72,8 @@ impl Deref for ZeroCopyBuf {
type Target = [u8];
fn deref(&self) -> &[u8] {
match self {
Self::FromV8(buf) => &*buf,
Self::Temp(vec) => &*vec,
Self::FromV8(buf) => buf,
Self::Temp(vec) => vec,
Self::ToV8(_) => panic!("Don't Deref a ZeroCopyBuf sent to v8"),
}
}
Expand Down
1 change: 1 addition & 0 deletions serde_v8/magic/v8slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub struct V8Slice {
pub(crate) range: Range<usize>,
}

// SAFETY: unsafe trait must have unsafe implementation
unsafe impl Send for V8Slice {}

impl V8Slice {
Expand Down
2 changes: 1 addition & 1 deletion serde_v8/serializable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl SerializablePkg {
&self,
scope: &mut v8::HandleScope<'a>,
) -> Result<v8::Local<'a, v8::Value>, crate::Error> {
match &*self {
match self {
Self::Primitive(x) => crate::to_v8(scope, x),
Self::Serializable(x) => x.to_v8(scope),
}
Expand Down
3 changes: 2 additions & 1 deletion test_util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,7 @@ impl hyper::server::accept::Accept for HyperAcceptor<'_> {
}

#[allow(clippy::non_send_fields_in_send_ty)]
// SAFETY: unsafe trait must have unsafe implementation
unsafe impl std::marker::Send for HyperAcceptor<'_> {}

async fn wrap_redirect_server() {
Expand Down Expand Up @@ -1897,7 +1898,7 @@ impl<'a> CheckOutputIntegrationTest<'a> {
// deno test's output capturing flushes with a zero-width space in order to
// synchronize the output pipes. Occassionally this zero width space
// 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}', "");
}

Expand Down

0 comments on commit e96933b

Please sign in to comment.